Click to See Complete Forum and Search --> : Strings in ASP.Net


akshatha306
July 21st, 2006, 07:58 AM
Hi all,

I have a problem. i guess its simple.. but as i'm new to asp.net i'm not able to get it rite.. somebody who can halp me?

ok i have String suppose-hi,howareyou,fine

i want to get the list of strings seperated by ,

like hi as one string
howareyou as another string
fine as another string

i didnt get the solution using String.subString...
May be String.Split will help.. i tried with that.. but not getting it rite...
Somebody who's good at this help me

Thanks

Shuja Ali
July 21st, 2006, 08:13 AM
When you use Split method of the string it basically return an array that needs to be stored in an array object. So it should be like this string sTemp = "hi,howareyou,fine";
char delimeter = ',';
string[] newString = sTemp.Split(delimeter);
foreach(string temp in newString)
MessageBox.Show(temp);

akshatha306
July 23rd, 2006, 11:30 PM
Hey thanks Shuja,
its working now... :-)