473,405 Members | 2,310 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

Question on string

Hello All,

I have a string of around 150 characters.

string test = "asjhdkashdkjahsdjkhaskjdhaskjdhasjdhasd........." ; //(upto
150 characters)

I want to split the above string into multiple lines in IDE while declaring
it so that it is more readable. How can I do that?

I do not want to concatenate using "+" nor do I want to use stringbuilder
object. I tried using @. If I use @ followed by the string, compiler is
inserting special characters like \t,\n. I think that I can StringBuilder
object but are there any other alternatives?

My goal is to be able to declare string like this without using "+" or
stringbuilder spread accross in multiple lines in IDE.

string test = "asjhdajkshdjkashdajksdhajskdhasd
sdfsjkdhfkjsdhfsjkdhfskjdfhskdjfhsd
sdfhsdjkfhsjdkfhsdjkfhsdjkfhsdkjfhs";

I hope I made sense as to what I want to achieve....

Thank you.
Jan 12 '06 #1
4 1576
Diffident,

How about turning on word wrapping in the IDE?

Tools - Options

Language node of your choice: Check the "Word wrap" check box.

--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
"Diffident" <Di*******@discussions.microsoft.com> wrote in message
news:D2**********************************@microsof t.com...
Hello All,

I have a string of around 150 characters.

string test = "asjhdkashdkjahsdjkhaskjdhaskjdhasjdhasd........." ; //(upto
150 characters)

I want to split the above string into multiple lines in IDE while
declaring
it so that it is more readable. How can I do that?

I do not want to concatenate using "+" nor do I want to use stringbuilder
object. I tried using @. If I use @ followed by the string, compiler is
inserting special characters like \t,\n. I think that I can StringBuilder
object but are there any other alternatives?

My goal is to be able to declare string like this without using "+" or
stringbuilder spread accross in multiple lines in IDE.

string test = "asjhdajkshdjkashdajksdhajskdhasd
sdfsjkdhfkjsdhfsjkdhfskjdfhskdjfhsd
sdfhsdjkfhsjdkfhsdjkfhsdjkfhsdkjfhs";

I hope I made sense as to what I want to achieve....

Thank you.

Jan 12 '06 #2
use the "+" for readability, as the compiler will optimize it out.

-- bruce (sqlwork.com)

"Diffident" <Di*******@discussions.microsoft.com> wrote in message
news:D2**********************************@microsof t.com...
Hello All,

I have a string of around 150 characters.

string test = "asjhdkashdkjahsdjkhaskjdhaskjdhasjdhasd........." ; //(upto
150 characters)

I want to split the above string into multiple lines in IDE while
declaring
it so that it is more readable. How can I do that?

I do not want to concatenate using "+" nor do I want to use stringbuilder
object. I tried using @. If I use @ followed by the string, compiler is
inserting special characters like \t,\n. I think that I can StringBuilder
object but are there any other alternatives?

My goal is to be able to declare string like this without using "+" or
stringbuilder spread accross in multiple lines in IDE.

string test = "asjhdajkshdjkashdajksdhajskdhasd
sdfsjkdhfkjsdhfsjkdhfskjdfhskdjfhsd
sdfhsdjkfhsjdkfhsdjkfhsdjkfhsdkjfhs";

I hope I made sense as to what I want to achieve....

Thank you.

Jan 12 '06 #3
Works great!!

Did not know that I could use word wrap.....

"S. Justin Gengo [MCP]" wrote:
Diffident,

How about turning on word wrapping in the IDE?

Tools - Options

Language node of your choice: Check the "Word wrap" check box.

--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
"Diffident" <Di*******@discussions.microsoft.com> wrote in message
news:D2**********************************@microsof t.com...
Hello All,

I have a string of around 150 characters.

string test = "asjhdkashdkjahsdjkhaskjdhaskjdhasjdhasd........." ; //(upto
150 characters)

I want to split the above string into multiple lines in IDE while
declaring
it so that it is more readable. How can I do that?

I do not want to concatenate using "+" nor do I want to use stringbuilder
object. I tried using @. If I use @ followed by the string, compiler is
inserting special characters like \t,\n. I think that I can StringBuilder
object but are there any other alternatives?

My goal is to be able to declare string like this without using "+" or
stringbuilder spread accross in multiple lines in IDE.

string test = "asjhdajkshdjkashdajksdhajskdhasd
sdfsjkdhfkjsdhfsjkdhfskjdfhskdjfhsd
sdfhsdjkfhsjdkfhsdjkfhsdjkfhsdkjfhs";

I hope I made sense as to what I want to achieve....

Thank you.


Jan 12 '06 #4
Bruce,

Can you please explain me how compiler would be able to optimize "+".

Why I did not want to use string concatenation was that I wanted it to be a
single string object and hence less memory would be used. But if I use "+"
does not that consume more memory due to string's inherent property of
immutability and hence heavy cost of concatenations?

Please correct me if I am wrong...

"Bruce Barker" wrote:
use the "+" for readability, as the compiler will optimize it out.

-- bruce (sqlwork.com)

"Diffident" <Di*******@discussions.microsoft.com> wrote in message
news:D2**********************************@microsof t.com...
Hello All,

I have a string of around 150 characters.

string test = "asjhdkashdkjahsdjkhaskjdhaskjdhasjdhasd........." ; //(upto
150 characters)

I want to split the above string into multiple lines in IDE while
declaring
it so that it is more readable. How can I do that?

I do not want to concatenate using "+" nor do I want to use stringbuilder
object. I tried using @. If I use @ followed by the string, compiler is
inserting special characters like \t,\n. I think that I can StringBuilder
object but are there any other alternatives?

My goal is to be able to declare string like this without using "+" or
stringbuilder spread accross in multiple lines in IDE.

string test = "asjhdajkshdjkashdajksdhajskdhasd
sdfsjkdhfkjsdhfsjkdhfskjdfhskdjfhsd
sdfhsdjkfhsjdkfhsdjkfhsdjkfhsdkjfhs";

I hope I made sense as to what I want to achieve....

Thank you.


Jan 12 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: kazack | last post by:
Hi all it's me again with another question as I got further in my book. The chapter I am in covers structres, abstract data and classes. I only read through to the end of the coverage on...
16
by: dario | last post by:
Hi, Im new on phyton programming. On my GPRS modem with embedded Phyton 1.5.2+ version, I have to receive a string from serial port and after send this one enclosed in an e-mail. All OK if the...
5
by: John Baro | last post by:
I have a richtextbox which I want the "literal" rtf of. richtextbox.rtf returns {\\rtf1\\ansi\\ansicpg1252\\deff0\\deflang1033\\uc1 }\r\n\0 when i put this into a string I get...
53
by: Jeff | last post by:
In the function below, can size ever be 0 (zero)? char *clc_strdup(const char * CLC_RESTRICT s) { size_t size; char *p; clc_assert_not_null(clc_strdup, s); size = strlen(s) + 1;
15
by: DV | last post by:
I have a StringBuilder that has a string with 12,000,000 characters. When I do a ToString(), I expect to have ~25,000,000 bytes worth of memory, yet, I end up with ~43,000,000 bytes. That's...
6
by: tshad | last post by:
I am playing with Inheritance and want to make sure I understand it. I have the following Classes: ******************************************* Public Class AuthHeader:Inherits SoapHeader Public...
6
by: RSH | last post by:
I am still trying to grasp the use of real world Objects and how to conceptualize them using a business scenerio. What I have below is an outline that I am wrestling with trying to figure out a...
0
by: | last post by:
I have a question about spawning and displaying subordinate list controls within a list control. I'm also interested in feedback about the design of my search application. Lots of code is at the...
29
by: Amar Kumar Dubedy | last post by:
implement a c++ class such that it allows us to add data members at runtime.
2
by: robtyketto | last post by:
Greetings, Within my jsp I have HTML code (see below) which accepts input, one of these fields sequence unlike the others is an Integer. <FORM ACTION="wk465682AddFAQ.jsp" METHOD="POST"> Id:...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.