Click to See Complete Forum and Search --> : split a string over two lines
raulbolanos
June 15th, 2009, 08:20 AM
How I can split the following string in two or more lines?
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
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
jmedved
June 15th, 2009, 08:24 AM
Something like this:string test = @"its something unpredictable
but in the end is right.
I hope you had the time of your life.";
raulbolanos
June 15th, 2009, 08:35 AM
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?
darwen
June 15th, 2009, 08:39 AM
Try this :
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 :
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.
jmedved
June 15th, 2009, 08:41 AM
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...
raulbolanos
June 15th, 2009, 08:49 AM
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.
raulbolanos
June 15th, 2009, 08:51 AM
Something like this: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.
codeguru.com
Copyright Internet.com Inc., All Rights Reserved.