Best way to split string into lines

If it looks ugly, just remove the unnecessary ToCharArray call. If you want to split by either \n or \r, you’ve got two options: Use an array literal – but this will give you empty lines for Windows-style line endings \r\n: var result = text.Split(new [] { ‘\r’, ‘\n’ }); Use a regular expression, as indicated … Read more

Set UILabel line spacing

Edit: Evidently NSAttributedString will do it, on iOS 6 and later. Instead of using an NSString to set the label’s text, create an NSAttributedString, set attributes on it, then set it as the .attributedText on the label. The code you want will be something like this: NSMutableAttributedString* attrString = [[NSMutableAttributedString alloc] initWithString:@”Sample text”]; NSMutableParagraphStyle *style … Read more

Split code over multiple lines in an R script

Bah, comments are too small. Anyway, @Dirk is very right. R doesn’t need to be told the code starts at the next line. It is smarter than Python 😉 and will just continue to read the next line whenever it considers the statement as “not finished”. Actually, in your case it also went to the … Read more

Split large string

String concatenation As per Documentation – Language Reference – Operators: & Concatenates/joins two strings. &= Concatenation assignment. Example: Global $g_sText = “Long ” & “string ” & “here.” & @CRLF $g_sText &= “More text.” & @CRLF ConsoleWrite($g_sText) Multi line statements As per Documentation – Language Reference – Comments (emphasis added, as it causes mentioned “unterminated … Read more