Separating parts of a string and assigning them to
Hi
Kindly note that I have an array string in which I store the string and split it with the help of a Delimiter ' | ' SO once the string is split,I need to assign the separated values in different variables...Please note I cannot declare the no of variables coz,I dunno how many values will be returning at Run time. So can somebody plz advise me as to how to store these values in different variables or array strings.
I am pasting the code below....
string formno = up.getUserPrivileges(uid);
string[] splits=null;
string strFinal=null;
if(formno!=null)
{
splits = formno.Split('|');
for(int i=0;i<splits.Length-1;i++)
{
strFinal=splits[i];
}
"formno" contains the string to be split....and "splits" contains the separated file with the delimiter.
Please let me know abt this at ur earliest. Thank You !
...Anubandh
P.S. "strFinal" keeps on overwriting the split value if there are more than one entry. In this case I need all the records to be stored in different variables.
|