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

string.split and Environment.NewLine question.

greetings...

i want to split a new line from an input text area and here's what i did

string.Split("\n \r ", ",");
the result, nothing happen...

then i tried this

string.Split(Environment.NewLine, ",");
and got the result what i wanted..
the question here is, why cant the 1st method work? whats wrong with it?
Nov 19 '05 #1
1 6160
The Environment.NewLine does not equal "\n \r "

The new line and carriage return characters are the wrong way round, and
cannot have any spaces between them.
Try this: "\r\n" (which is equal to Environment.NewLine)

"Asha" <As**@discussions.microsoft.com> wrote in message
news:98**********************************@microsof t.com...
greetings...

i want to split a new line from an input text area and here's what i did

string.Split("\n \r ", ",");
the result, nothing happen...

then i tried this

string.Split(Environment.NewLine, ",");
and got the result what i wanted..
the question here is, why cant the 1st method work? whats wrong with it?

Nov 19 '05 #2

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

Similar topics

2
by: sean | last post by:
Can anyone tell me how to add a carriage return to a string using vb.net? I need to add two strings with a carrage return together and post to an email message body ie: This gives me an...
3
by: retsam | last post by:
All, I'm working on an ASP.NET 2.0 (C#) page and have a question on how to build a string that includes line feeds (new lines) that displays properly on an ASP.NET page. Here's what I got: ...
5
by: Daniel | last post by:
Hi I would like to remove everything else but one line of text in a String. I have tried using .Split("\n"), however I did not succeed. The string contains three lines, but I only need the...
5
by: Jamie Risk | last post by:
This is the code snippet that I've come up to convert a byte to string. Is there a best practiced method for such a conversion? - Jamie public static string ByteArrayToString(byte array) {...
3
by: jwgoerlich | last post by:
Hello group, I am working on a query string class. The purpose is to parse name-value pairs from incoming text. Currently, I am using the Regex code below. I have two questions. First, the...
12
by: John | last post by:
Hi I have a multi-line address field which has each line separated by CRLF. How can I split this field into individual strings using crlf as separator? Thanks Regards
4
by: alfred | last post by:
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...
3
by: Ronald S. Cook | last post by:
I have a string (see below) that I want to parse out the values. As you can see, some are element-based and some are attribute-based. <METADATA version="Format5"><TITLE value="Adrenaline...
5
by: LEM | last post by:
Hi, I'm trying to remove any empty lines from a string, and I am doing the following: String pp; pp = "\r\n\r\n1\r\n23\r\n\r\n4"; pp = pp.Replace("\r\n\r\n", "\r\n");
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
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
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,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...

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.