|
-
Aug 19th, 2003, 01:35 AM
#1
Thread Starter
Hyperactive Member
How to split the string in simple way
I have a string with delimiters.The folowing code runs fine & I achived the target i want but can i get a 0th and 1st array directly when i split the string .how do i modify the innermost foreach loop.
see he code below:
columnFields="dww,243\n\r32,sedwe\n\r";
foreach (string strField in columnFields.Split("\n"))
{
int iFld=0;
foreach (string strFld in strField.Split(","))
{
if(iFld==0)
{
sVal1=strFld; //First value ie "dww"
iFld+=1;
}
else
{
sVal2 =strFld.Replace("\r","");//second value ie."243"
}
}
}
Help expected..
regards,
PPCC
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|