Rectangle 27 384

But this only does indentation. What about moving braces, taking care of line breaks, etc?

It shouldn't be accepted as it doesn't perform all the things a code formatter would handle. It just re-indents,

yes @powerj1984. I am also disappointed with this. It does not add proper spaces after ,, = or other operators. What it does just intent. Nothing else. Mac really needs to learn from Microsoft here.

Xcode source automatic formatting - Stack Overflow

xcode formatting keyboard-shortcuts
Rectangle 27 535

Experimentally, I've discovered that you can provide:

  • Single line breaks are ignored; double line breaks open a new paragraph.
  • Single line breaks can be enforced by ending a line with two spaces (similar to Markdown).
<b></b>
<i></i>
<u></u>
<br />
  • I could not find any way to get strikethrough working (neither HTML or Markdown style).
  • A fully-formatted URL such as http://google.com; this appears as a hyperlink. (Beware that trying to use an HTML <a> tag for a custom description does not work and breaks the formatting.)
  • HTML character entities are supported, such as (), () and (); consult this W3 reference for the exhaustive list.
  • UTF-8 encoded characters are supported, such as , , , , , and .
  • Indentation isn't strictly possible, but using a bullet and em space character looks reasonable ( yields "").
  • Emoji are also supported (though on the website depends on the user's OS & browser).
<blockquote></blockquote>
<small></small>
<sup></sup>
<sub></sub>
<font color="#a32345"></font>
  • Some symbols do not appear correctly, such as .
  • All HTML formatting appears as plain text in the website's "What's New" section (i.e. users will see the HTML source).

Is it just me, or font color is not supported anymore? :(

It seems that indeed font color no longer works on the Google Play website. At the moment, it does still appear in the Google Play app.

Does it also work in the "What's New" section?

@Tom All formatting above works in the Google Play app, but I'm afraid only plain text works on the website's "What's New" section.

I would add this link: support.google.com/googleplay/android-developer/answer/ in order to complete the answer. Experiments can help developers to decide / test which description is better, by adding 2 or more variants.

android - Google Play app description formatting - Stack Overflow

android formatting google-play
Rectangle 27 107

Unfortunately, Xcode doesn't have anything nearly as extensive as VS or Jalopy for Eclipse available. There are SOME disparate features, such as Structure > Re-Indent as well as the auto-formatting used when you paste code into your source file. I am totally with you, though; there definitely should be something in there to help with formatting issues.

Thank you, at least I know I am not missing something. Auto-identing does help dull the pain some what, but I will have to look into a third-party solution.

this shouldn't be selected as the answer. the answer below from @ken is correct

@RyanAngilly Notice the year this question was answered. Many things have changed with Xcode since then. ;-)

@RyanAngilly ken only described how to auto-indent. That's not what "format" (with white space and new-line addition and removal and such things) really means.

Indentation can be fixed with control-i, that wil indent all selected lines.

Xcode source automatic formatting - Stack Overflow

xcode formatting keyboard-shortcuts
Rectangle 27 58

Your code actually is valid Python if you remove two characters, the comma and the colon.

>>> gender= "male"
>>> print "At least, that's what %s told me." %("he" if gender == "male" else "she")
At least, that's what he told me.
.format
>>> s = "At least, that's what {pronoun} told me.".format(pronoun="he" if gender == "male" else "she")
>>> s
"At least, that's what he told me."

where the argument to format can be a dict you build in whatever complexity you like.

Thank you. I thought there would be a setup like that, but I guess I didn't use the proper search terms. Good to know that it is possible, and that I knew more about Python's style than I thought.

@NiklasR: str.format() was introduced in Python 2.6, not 2.7.

@SvenMarnach Oh, I'm sorry you are right.

Python conditional string formatting - Stack Overflow

python string-formatting
Rectangle 27 34

I'd like to recommend two options worth considering. Both quite new and evolving.

ClangFormat-Xcode (free) - on each cmd+s file is reformatted to specific style and saved, easy to deploy within team

With clang-format you can use Clang to format your code to styles such as LLVM, Google, Chromium, Mozilla, WebKit, or your own configuration.

Objective-Clean (paid, didn't try it yet) - app raising build errors if predefined style rules are violated - possibly quite hard to use within the team, so I didn't try it out.

With very minimal setup, you can get Xcode to use our App to enforce your rules. If you are ever caught violating one of your rules, Xcode will throw a build error and take you right to the offending line.

Xcode source automatic formatting - Stack Overflow

xcode formatting keyboard-shortcuts
Rectangle 27 1

Turns out all you have to do is:

myEditor._createCurrentElement('span');
newEl = myEditor.currentElement[0];

_createCurrentElement internally creates a new element with the current selection as the innerHTML and preserves the formatting for you. So simple...thanks to Dav Glass for his help. Check out his post here: http://yuilibrary.com/forum/viewtopic.php?f=89&t=5436&p=18659#p18659

javascript - YUI editor (RTE): How to wrap selection with a and...

javascript editor yui rte yui-editor
Rectangle 27 24

In xcode, you can use this shortcut to format (re-indent) your source code

Xcode source automatic formatting - Stack Overflow

xcode formatting keyboard-shortcuts
Rectangle 27 96

Edit->Line->Reindent
Preferences -> Key Bindings User
{ "keys": ["alt+shift+f"], "command": "reindent"}

I use alt+shift+f because I'm a Netbeans user.

To format your code, select all by pressing ctrl+a and "your key combination". Excuse me for my bad english.

Or if you don't want to select all before formatting, add an argument to the command instead:

{ "keys": ["alt+shift+f"], "command": "reindent", "args": {"single_line": false} }

sublimetext - Sublime Text 2 Code Formatting - Stack Overflow

sublimetext prettify sublimetext2
Rectangle 27 24

You can also use the TEXT() function quite easily (Note: source data must be an excel date value)

TEXT(value, format_text)

where value is the reference cell and format_text is how you want to format the text- in your case dd/mm/yyyy.

A1 = 3/17/2013
A2 = 12/27/2013
B1 = TEXT(A1, "dd/mm/yyyy")
B2 = TEXT(A2, "dd/mm/yyyy")

and the result should be

A              B
3/17/2013      17/03/2013
12/27/2013     27/12/2013

Split the string using mid(), left() and right() functions then check to see if the month mm is 1 or 2 characters long using the LEN() function. Finally concatenatr the string together using the & and / operators.

Try pasting this in B1, it should work fine:

This for some reason refuses to work on the "m/dd/yyyy" format as it isn't recognising it as a date at all. Therefore in your example "A1" remains 3/17/2013 whilst "A2" becomes 27/12/2013

for the TEXT() function to work the source data must be a date. Are you able to import the data using Import Data from Text (csv) and set the dates column as MDY? you can then use the TEXT() function

I tried this and it did not work. I think I need a code that will pull apart the date or string and put it back together as a date

=MID(A1,FIND("/",A1,1)+1,2)&"/"&IF(LEN(LEFT(A1,FIND("/",A1)-1))=1,0&LEFT(A1,FIND("/",A1)-1),LEFT(A1,FIND("/",A1)-1))&"/"&RIGHT(A1,4)

The code in the main body of your answer works now once I convert the column into a string using David's macro. I don't know why this is. Crazy that I have to do this two steps to get the date as I want it! Thanks again

Excel Date Formatting - Stack Overflow

excel date
Rectangle 27 20

TimeSpan ts = new TimeSpan(0, 70, 0);
String.Format("{0} hour{1} {2} minute{3}", 
              ts.Hours, 
              ts.Hours == 1 ? "" : "s",
              ts.Minutes, 
              ts.Minutes == 1 ? "" : "s")

Shame, unfortunately sometimes the time can be <1 hour, so that wont quite do it. Guess i'll just have to do a bit of iffing :) Ty anyway

When its < 1 hour, modify the condition from this ts.Hours == 1 ? "" : "s", to this ts.Hours <= 1 ? "" : "s",

@jalchr: Plural is correct for zero values so leave it as == 1. e.g. 0 Hours, 0 Minutes is correct.

c# - Timespan formatting - Stack Overflow

c# .net timespan
Rectangle 27 18

My personal fav PrettyC wantabe is uncrustify: http://uncrustify.sourceforge.net/. It's got a few billion options however so I also suggest you download UniversalIndentGUI_macx, (also on sourceforge) a GUI someone wrote to help set the options the way you like them.

You can then add this custom user script to uncrustify the selected text:

#! /bin/sh
#
# uncrustify!
echo -n "%%%{PBXSelection}%%%"
/usr/local/bin/uncrustify -q -c /usr/local/share/uncrustify/geo_uncrustify.cfg -l oc+ <&0
echo -n "%%%{PBXSelection}%%%"

I've had issues with uncrustify, especially with formatting blocks.

Xcode source automatic formatting - Stack Overflow

xcode formatting keyboard-shortcuts
Rectangle 27 662

In preferences Java -> Code Style -> Formatter, edit the profile. Under the Line Wrapping tab is the primary option for line width (Maximum line width:). In the Comments tab you have a separate option Maximum line width for comments:, which will also need to be changed to affect comment wrapping.

You will need to make your own profile to make these changes in if you using one of the [Built-in] ones. Just click "New..." on the formatter preferences page.

This wasn't working for me so I disabled formatting of comment lines entirely. It's nearly exactly the same except instead of the 'Line Wrapping' tab you want 'Comments' tab and uncheck 'Enable line comment formatting'

This is the correct answer, althought it doesn't force the width on comments. Go to the "Comments" tab, and on the bottom there's the field "Line width" to change the maximum line width for comments.

Note: Eclipse (Kepler, at least) very obnoxiously allows you to edit the built-in profile to your heart's content, only to stop you from saving it with an unobtrusive notification that you CAN'T edit built-in profiles, and must create a copy and edit that instead.

"Line Wrapping tab" is not a complete answer. As Henrique Sousa and some other IDs mentioned, it still need to go to "Comments" tab. I was bugged by line-wrapping in comments. :)

Using Luna at least, all you have to do is change the text field at the top of the options tabs to something other than Eclipse [Default] and click Apply. It saved all my modifications I was trying to make to the default profile.

java - Eclipse: Set maximum line length for auto formatting? - Stack O...

java eclipse ide
Rectangle 27 656

In preferences Java -> Code Style -> Formatter, edit the profile. Under the Line Wrapping tab is the primary option for line width (Maximum line width:). In the Comments tab you have a separate option Maximum line width for comments:, which will also need to be changed to affect comment wrapping.

You will need to make your own profile to make these changes in if you using one of the [Built-in] ones. Just click "New..." on the formatter preferences page.

This wasn't working for me so I disabled formatting of comment lines entirely. It's nearly exactly the same except instead of the 'Line Wrapping' tab you want 'Comments' tab and uncheck 'Enable line comment formatting'

This is the correct answer, althought it doesn't force the width on comments. Go to the "Comments" tab, and on the bottom there's the field "Line width" to change the maximum line width for comments.

Note: Eclipse (Kepler, at least) very obnoxiously allows you to edit the built-in profile to your heart's content, only to stop you from saving it with an unobtrusive notification that you CAN'T edit built-in profiles, and must create a copy and edit that instead.

"Line Wrapping tab" is not a complete answer. As Henrique Sousa and some other IDs mentioned, it still need to go to "Comments" tab. I was bugged by line-wrapping in comments. :)

Using Luna at least, all you have to do is change the text field at the top of the options tabs to something other than Eclipse [Default] and click Apply. It saved all my modifications I was trying to make to the default profile.

java - Eclipse: Set maximum line length for auto formatting? - Stack O...

java eclipse ide
Rectangle 27 13

public static string Pluralize(int n, string unit)
{
    if (string.IsNullOrEmpty(unit)) return string.Empty;

    n = Math.Abs(n); // -1 should be singular, too

    return unit + (n == 1 ? string.Empty : "s");
}

public static string TimeSpanInWords(TimeSpan aTimeSpan)
{
    List<string> timeStrings = new List<string>();

    int[] timeParts = new[] { aTimeSpan.Days, aTimeSpan.Hours, aTimeSpan.Minutes, aTimeSpan.Seconds };
    string[] timeUnits = new[] { "day", "hour", "minute", "second" };

    for (int i = 0; i < timeParts.Length; i++)
    {
        if (timeParts[i] > 0)
        {
            timeStrings.Add(string.Format("{0} {1}", timeParts[i], Pluralize(timeParts[i], timeUnits[i])));
        }
    }

    return timeStrings.Count != 0 ? string.Join(", ", timeStrings.ToArray()) : "0 seconds";
}

I just did in my own code, simple as adding a "this" before the parameter.

I wish pluralizing in Russian would be as simple as it is in English =)

@MaximV.Pavlov +1 Hilarious comment >;-) I'd like to see a Russian pluraliser that could correctly write "2345678" in words in the sentence "with 2345678 girls". Actually, I've yet to meet a human that can do it without hesitation.

c# - Timespan formatting - Stack Overflow

c# .net timespan
Rectangle 27 12

You can use Command + A to select all content and next Ctrl + I to format the selected content.

kbd

Xcode source automatic formatting - Stack Overflow

xcode formatting keyboard-shortcuts
Rectangle 27 26

It lets you insert special characters like bullets '' (), '' (), ... the HTML way.

Note that you can also (and probably should) type special characters directly in the form fields if you can enter international characters.

=> one consideration here is whether or not you care about third-party sites that collect data on your app from Google Play : some might simply take it as HTML content, others might insert it in a native application that just understand plain Unicode...

Is there a tag/character for indentation?

android - Google Play app description formatting - Stack Overflow

android formatting google-play
Rectangle 27 28

You can extract the attributes as a dictionary with:

NSDictionary *attributes = [(NSAttributedString *)label.attributedText attributesAtIndex:0 effectiveRange:NULL];

Then add them back with the new text:

label.attributedText = [[NSAttributedString alloc] initWithString:@"Some text" attributes:attributes];

This assumes the label has text in it, otherwise you'll crash so you should probably perform a check on that first with:

if ([self.label.attributedText length]) {...}

Actually, iOS should do it by default, anyway we have our way. Thanks, your suggestion helped me.

iphone - Change the text of an attributed UILabel without losing the f...

iphone ios xcode ios6
Rectangle 27 19

Currently (July 2015), HTML escape sequences ( ) do not work in browser version of Play Store, they're displayed as text. Though, Play Store app handles them as expected.

So, if you're after the unicode bullet point in your app/update description [that's what's got you here, most likely], just copy-paste the bullet character

PS You can also use unicode input combo to get the character

2022

PPS If you're feeling creative, here's a good link with more copypastable symbols, but don't go too crazy, nobody likes clutter in what they read.

I just thought I would mention that Alt+Num7 also works for bullet points and is easier to remember.

android - Google Play app description formatting - Stack Overflow

android formatting google-play
Rectangle 27 8

You can also have a look at https://github.com/octo-online/Xcode-formatter which is a formatter based on Uncrustify and integrated into Xcode. Works like a charm.

Xcode source automatic formatting - Stack Overflow

xcode formatting keyboard-shortcuts
Rectangle 27 8

See the documentation for String.format(). Use maximum length each column can be, plus 1.

Java text formatting - Stack Overflow

java text formatting