String Separator

  • Thread starter Thread starter kvicky
  • Start date Start date
K

kvicky

Can anybody help with this , I have a String like"ABCDE", I wanted to
convert this into string array String array[]={"A","B","C","D","E"}. I
know we have to use string.Split(). But not sure how to send the
Delimiter.

Thanks
K
 
You should not use Split() method. Try ToCharArray and call ToString on each
char in the array returned instead.
 
Lebesgue said:
You should not use Split() method. Try ToCharArray and call ToString on each
char in the array returned instead.

kvicky said:
Can anybody help with this , I have a String like"ABCDE", I wanted to
convert this into string array String array[]={"A","B","C","D","E"}. I
know we have to use string.Split(). But not sure how to send the
Delimiter.

Thanks
K

Thank you so much...it worked!!!

K
 
You could call Split() with empty string as the delimiter. Less work than
converting to chars and back to strings, assuming the chars need to be
changed back to strings.


Lebesgue said:
You should not use Split() method. Try ToCharArray and call ToString on each
char in the array returned instead.

kvicky said:
Can anybody help with this , I have a String like"ABCDE", I wanted to
convert this into string array String array[]={"A","B","C","D","E"}. I
know we have to use string.Split(). But not sure how to send the
Delimiter.

Thanks
K
 
Thanks for pointing this out. I thought this could work but couldn't check
at the time I was replying to the original question.

KH said:
You could call Split() with empty string as the delimiter. Less work than
converting to chars and back to strings, assuming the chars need to be
changed back to strings.


Lebesgue said:
You should not use Split() method. Try ToCharArray and call ToString on
each
char in the array returned instead.

kvicky said:
Can anybody help with this , I have a String like"ABCDE", I wanted to
convert this into string array String array[]={"A","B","C","D","E"}. I
know we have to use string.Split(). But not sure how to send the
Delimiter.

Thanks
K
 
Back
Top