Click here to Skip to main content
15,899,563 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I have string like this

welcome
to
Asp.net
World

Now I want to split and save as an array.

Please help
Posted

Use string.split function.

Split Method[^]
 
Share this answer
 
C#
string s = "Welcome to asp.net world";
string[] words = s.Split(' ');
 
Share this answer
 
Comments
srmohanr 22-Oct-13 4:29am    
My scenario will be different..
I am using xml tags.
I want to split into lines.

DataSet ds = new DataSet();
ds.ReadXml(Server.MapPath("~/XML/getIR-KnownVuln-Response-Latest-version.xml"));
string xml = ds.GetXml();
string []Xstr = Regex.Split(ds.GetXml(), "\n");
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900