We help IT Professionals succeed at work.

Check out our new AWS podcast with Certified Expert, Phil Phillips! Listen to "How to Execute a Seamless AWS Migration" on EE or on your favorite podcast platform. Listen Now

x

String.split

dchau12
dchau12 asked
on
Medium Priority
218 Views
Last Modified: 2012-05-07
How do I use the String.split method when the delimiter is a carrage return?  

Or, how do I use String.split with a string delimeter instead of a character delimiter?  So, in the case the delimiter would be  "\r"
Comment
Watch Question

Unlock this solution with a free trial preview.
(No credit card required)
Get Preview
√Čric MoreauSenior .Net Consultant
CERTIFIED EXPERT
Top Expert 2016

Commented:
or you can use Environment.NewLine

Author

Commented:
hey satjheeshm, str2 = str1.Split('\n');  does not work.  The delimiter is looking for a character.  A character is only one entry.  '\n' is a string.
Gary DavisDir Internet Svcs
Commented:
Unlock this solution with a free trial preview.
(No credit card required)
Get Preview
Gary DavisDir Internet Svcs

Commented:
Continued....
The str2 string array has three elements after the split. The last element is and empty string.
Gary Davis

Author

Commented:
I was dead wrong.  Good follow up gardavis.
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a free trial preview!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.