-
June 15th, 2009, 08:20 AM
#1
split a string over two lines
How I can split the following string in two or more lines?
Code:
string test = "its something unpredictable but in the end is right. I hope you had the time of your life.";
which set of buttons should I use to split it like this and the string will be still logicaly one line
Code:
string test = "its something unpredictable
but in the end is right.
I hope you had the time of your life.";
this is helpful to send queries to the DB's
-
June 15th, 2009, 08:24 AM
#2
Re: split a string over two lines
Something like this:
Code:
string test = @"its something unpredictable
but in the end is right.
I hope you had the time of your life.";
-
June 15th, 2009, 08:35 AM
#3
Re: split a string over two lines
but for example I target the point which I want into the new line, afterwards if I simply press ENTER the string at the next line wont be red anymore and it wont belong anymore to the previous line.
Is there any set of buttons like ctrl + ? to make this new line without loss this property?
-
June 15th, 2009, 08:39 AM
#4
Re: split a string over two lines
Try this :
Code:
string test = "its something unpredictable" + Environment.NewLine +
"but in the end is right." + Environment.NewLine +
"I hope you had the time of your life.";
And for the puritans out there :
Code:
StringBuilder testStringBuilder = new StringBuilder();
testStringBuilder.AppendLine("its something unpredictable");
testStringBuilder.AppendLine("but in the end is right.");
testStringBuilder.AppendLine("I hope you had the time of your life");
string test = testStringBuilder.ToString();
Darwen.
-
June 15th, 2009, 08:41 AM
#5
Re: split a string over two lines
Originally Posted by raulbolanos
but for example I target the point which I want into the new line, afterwards if I simply press ENTER the string at the next line wont be red anymore and it wont belong anymore to the previous line.
Is there any set of buttons like ctrl + ? to make this new line without loss this property?
I am not exactly sure what question is, but if you are thinking about some command that will automatically generate multiple lines from one, that is not available.
If you want multiple lines in one variable, you must press enter where you want line break.
However, you could make some macro for that...
-
June 15th, 2009, 08:49 AM
#6
Re: split a string over two lines
Originally Posted by jmedved
I am not exactly sure what question is, but if you are thinking about some command that will automatically generate multiple lines from one, that is not available.
If you want multiple lines in one variable, you must press enter where you want line break.
However, you could make some macro for that...
Oh, I see... thank you.
-
June 15th, 2009, 08:51 AM
#7
Re: split a string over two lines
Originally Posted by jmedved
Something like this:
Code:
string test = @"its something unpredictable
but in the end is right.
I hope you had the time of your life.";
You were right... I only need the '@' character.
Thank you very much.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|