473,385 Members | 1,753 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,385 software developers and data experts.

Formatting string with end of line

Hi everyone, I have a problem. I have create a string (its name is
book) and i want to insert the books with this text formatting:
First book
Second book
third book
ecc....

with the end of line at the end of the string so if i want to write
into a file XML this is the style that i want to do. In my program the
XML is:
First book Second book third
book ecc....

How can i do this?

Thank you

Feb 11 '07 #1
4 4361
On Feb 11, 6:10 pm, "alfred" <spicesta...@hotmail.comwrote:
Hi everyone, I have a problem. I have create a string (its name is
book) and i want to insert the books with this text formatting:
First book
Second book
third book
ecc....

with the end of line at the end of the string so if i want to write
into a file XML this is the style that i want to do. In my program the
XML is:
First book Second book third
book ecc....

How can i do this?

Thank you
you need to insert carriage return line feed into string.

If you use VB you can use this constant: vbCrLf

"First book" & vbCrLf & "Second book"....

If you use C#: "\n\r"

"First book" + "\n\r" + "Second book"....

Feb 12 '07 #2
Alexey Smirnov wrote:
On Feb 11, 6:10 pm, "alfred" <spicesta...@hotmail.comwrote:
>Hi everyone, I have a problem. I have create a string (its name is
book) and i want to insert the books with this text formatting:
First book
Second book
third book
ecc....

with the end of line at the end of the string so if i want to write
into a file XML this is the style that i want to do. In my program the
XML is:
First book Second book third
book ecc....

How can i do this?

Thank you

you need to insert carriage return line feed into string.

If you use VB you can use this constant: vbCrLf

"First book" & vbCrLf & "Second book"....
Use the value in Environment.NewLine. That is programming language
independent and system independent.

"First book" & Environment.NewLine & "Second book"
If you use C#: "\n\r"
That is a line feed and a carrege return. It should be "\r\n". That is
wnat Environment.NewLine contains for an non-unix system. But
Evironment.Newline works for any system.
"First book" + "\n\r" + "Second book"....

--
Göran Andersson
_____
http://www.guffa.com
Feb 12 '07 #3
On Feb 12, 9:40 pm, Göran Andersson <g...@guffa.comwrote:
Use the value in Environment.NewLine. That is programming language
independent and system independent.
you're right, do \r\n instead

regarding Environment.NewLine: I don't see any sense to be language
independent in his case. And in general, using Environment.NewLine in
ASP.net could be the cause of problems with different kind of clients
as it represents a server value.

Feb 12 '07 #4
Alexey Smirnov wrote:
On Feb 12, 9:40 pm, Göran Andersson <g...@guffa.comwrote:
>Use the value in Environment.NewLine. That is programming language
independent and system independent.

you're right, do \r\n instead

regarding Environment.NewLine: I don't see any sense to be language
independent in his case. And in general, using Environment.NewLine in
ASP.net could be the cause of problems with different kind of clients
as it represents a server value.
Yes, you are right, Environment.NewLine represents a line break on the
server system, so that might not always be what's desired.

On the other hand, there isn't really anything in this question (besides
where it's posted) that suggests that it has anything to do with the web
at all.

--
Göran Andersson
_____
http://www.guffa.com
Feb 13 '07 #5

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

Similar topics

7
by: ilona | last post by:
Hi all, I store phone numbers in the database as 123447775665554(input mask is used for input, and some numbers have extensions), and I also know from db if the number is Canadian, US, or some...
4
by: hope | last post by:
Hi, How can I format a string field using Data Formatting Expression property in datagrid? For example: format last name from BROWN to Brown. Thanks
0
by: marfi95 | last post by:
I have an xml file that I want to maintain the whitespace on and spacing between my sections. I have something like this. <!-- Comment lines A --> <!-- Comment lines A --> <A> <B>test</B>...
8
by: gopal | last post by:
Hi I am trying to write to log file but the formatting of string is not properly aligned in log file result The results looks some thing like this OK move.xml Successful OK ...
14
by: Scott M. | last post by:
Ok, this is driving me nuts... I am using VS.NET 2003 and trying to take an item out of a row in a loosely-typed dataset and place it in a label as a currency. As it is now, I am getting my...
7
by: Leon | last post by:
Hi, I'm creating a python script that can take a string and print it to the screen as a simple multi-columned block of mono-spaced, unhyphenated text based on a specified character width and...
6
by: Brian Schwartz | last post by:
Quick question related to Visual Studio's automatic code formatting. Often I like to write my variable declarations with spacing to line them up, like this (not sure if this spacing will come out...
6
by: Jack | last post by:
Hi there, Given a standard .NET string, does anyone know what the regular expression would be to locate each (optional) formatting item in the string (or more likely does anyone have a link that...
2
by: Jean-Paul Calderone | last post by:
On Fri, 5 Sep 2008 14:24:16 -0500, Robert Dailey <rcdailey@gmail.comwrote: mystring = ( "This is a very long string that " "spans multiple lines and does " "not include line breaks or tabs "...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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...

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.