Questions tagged [multiline]

Text that spans more than one line is considered "multiline". Concerns about wrapping, spacing, techniques and best practices.

Text that spans more than one line is considered "multiline". Concerns about wrapping, spacing, techniques and best practices, as well as language and platform-specific techniques for displaying text in a multiline format.

1916 questions
226
votes
1 answer

C multi-line macro: do/while(0) vs scope block

Possible Duplicates: What’s the use of do while(0) when we define a macro? Why are there sometimes meaningless do/while and if/else statements in C/C++ macros? do { … } while (0) what is it good for? I've seen some multi-line C macros that are…
krasnaya
  • 2,995
  • 3
  • 21
  • 19
222
votes
6 answers

Paste a multi-line Java String in Eclipse

Unfortunately, Java has no syntax for multi-line string literals. No problem if the IDE makes it easy to work with constructs like String x = "CREATE TABLE TEST ( \n" + "A INTEGER NOT NULL PRIMARY KEY, \n" ... What is…
Thilo
  • 257,207
  • 101
  • 511
  • 656
219
votes
8 answers

What is the proper way to format a multi-line dict in Python?

In Python, I want to write a multi-line dict in my code. There are a couple of ways one could format it. Here are a few that I could think of: mydict = { "key1": 1, "key2": 2, "key3": 3, } mydict = { "key1": 1, …
Ryan C. Thompson
  • 40,856
  • 28
  • 97
  • 159
195
votes
9 answers

How do I create a multiline Python string with inline variables?

I am looking for a clean way to use variables within a multiline Python string. Say I wanted to do the following: string1 = go string2 = now string3 = great """ I will $string1 there I will go $string2 $string3 """ I'm looking to see if there is…
evolution
  • 4,332
  • 5
  • 29
  • 34
187
votes
9 answers

How do I do a multi-line string in node.js?

With the rise of node.js, multi-line strings are becoming more necessary in JavaScript. Is there a special way to do this in Node.JS, even if it does not work in browsers? Are there any plans or at least a feature request to do this that I can…
700 Software
  • 85,281
  • 83
  • 234
  • 341
186
votes
12 answers

Best way to split string into lines

How do you split multi-line string into lines? I know this way var result = input.Split("\n\r".ToCharArray(), StringSplitOptions.RemoveEmptyEntries); looks a bit ugly and loses empty lines. Is there a better solution?
Konstantin Spirin
  • 20,609
  • 15
  • 72
  • 90
177
votes
23 answers

android ellipsize multiline textview

I need to ellipsize a multi-line textview. My component is large enough to display at least 4 lines with the ellipse, but only 2 lines are displayed. I tried to change the minimum and maximum number of rows of the component but it changes nothing.
Arutha
  • 26,088
  • 26
  • 67
  • 80
175
votes
21 answers

Multiline TextView in Android?

I did like below in xml
Chatar Veer Suthar
  • 15,541
  • 26
  • 90
  • 154
166
votes
9 answers

Split code over multiple lines in an R script

I want to split a line in an R script over multiple lines (because it is too long). How do I do that? Specifically, I have a line such as setwd('~/a/very/long/path/here/that/goes/beyond/80/characters/and/then/some/more') Is it possible to split the…
Curious2learn
  • 31,692
  • 43
  • 108
  • 125
155
votes
3 answers

What's wrong with Groovy multi-line String?

Groovy scripts raises an error: def a = "test" + "test" + "test" Error: No signature of method: java.lang.String.positive() is applicable for argument types: () values: [] While this script works fine: def a = new String( "test" + "test" …
yegor256
  • 102,010
  • 123
  • 446
  • 597
153
votes
7 answers

Regular expression matching a multiline block of text

I'm having a bit of trouble getting a Python regex to work when matching against text that spans multiple lines. The example text is (\n is a newline) some Varying TEXT\n \n DSJFKDAFJKDAFJDSAKFJADSFLKDLAFKDSAF\n [more of the above, ending with a…
Jan
  • 4,366
  • 6
  • 22
  • 21
137
votes
5 answers

Can a JSON value contain a multiline string

I am writing a JSON file which would be read by a Java program. The fragment is as follows... { "testCases" : { "case.1" : { "scenario" : "this the case 1.", "result" : "this is a very long line which is not easily readble. …
user2409155
  • 1,379
  • 2
  • 8
  • 3
134
votes
2 answers

How do I enter a multi-line comment in Perl?

Possible Duplicate: What are the common workarounds for multi-line comments in Perl? How do I add a multi-line comment to Perl source code?
vrbilgi
  • 5,703
  • 12
  • 44
  • 60
130
votes
7 answers

Commenting multiple lines in DOS batch file

I have written huge MS DOS Batch file. To test this batch file I need to execute some lines only and want to hide/comment out remaining. I have some existing comment lines starting with :: hence I cannot use :: anymore as it will scramble all…
user219628
  • 3,755
  • 8
  • 35
  • 37
129
votes
4 answers

Multiline C# interpolated string literal

C# 6 brings compiler support for interpolated string literals with syntax: var person = new { Name = "Bob" }; string s = $"Hello, {person.Name}."; This is great for short strings, but if you want to produce a longer string must it be specified on…
Drew Noakes
  • 300,895
  • 165
  • 679
  • 742