
November 9th, 2000, 10:49 AM
|
|
Contributing User
|
|
Join Date: Dec 2002
Posts: 14,575
  
Time spent in forums: < 1 sec
Reputation Power: 22
|
|
|
<i><b>Originally posted by : Akhilesh Kumar (akhilesh-kumar@usa.net)</b></i><br /><br /><br /><br />------------<br />RAJ at 9/26/2000 10:56:18 AM<br /><br />How do I separate a comma separated text into an array.<br />for example:<br />states=st1,st2,st3,st4,st5 <br /> to<br />states[1] = st1<br />states[2] = st2<br />...<br />states[i] =sti <br /><br />I would like to do this in ASP as the variable is also an asp variable<br /><br />Thanks<br /><br />hi Raj,<br /> It's a very simple thing to separate a comma<br />separated string.There is one function in vbscript<br />states = Split(string,",")<br />This function takes two input parameters.<br />first parameter is the comma separated string.<br />you don't have to do anything else the string will<br />be automatically split and stored in to an array.<br />But mind it you substring i.e str1,str2.. should not contain an array , otherwise you won't be able to achieve your objective.<br />In that case you can replace "," by some other<br />symbol and again replace it back after you get an array of splitted substrings.<br /> thanks .<br />Reply soon if your problem is solved.
|