Link to home
Start Free TrialLog in
Avatar of dchau12
dchau12

asked on

String.split

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"
ASKER CERTIFIED SOLUTION
Avatar of satheeshm
satheeshm

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Éric Moreau
or you can use Environment.NewLine
Avatar of dchau12
dchau12

ASKER

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.
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Continued....
The str2 string array has three elements after the split. The last element is and empty string.
Gary Davis
Avatar of dchau12

ASKER

I was dead wrong.  Good follow up gardavis.