how to use substring function so that i can divide the string with space into two different string..............
if i hv "abc def" then it will be divided into "abc" and "def" or if i hv "rajan himachal" then it will be divided into "rajan" and "himachal" ...........
help me to solve this problem..................
How to divide the string into substring
3 Answers
Know the answer? Post it. Somebody with the same question will find it here.

Marimuthu ArigovindasamyRank #5,893 · 283 reputationPosted Jun 14, 2010, 8:20 PM EDT
You can use the split function for the same.
string aaa = "rajan himachal";
string[] sss; ;
sss = aaa.Split(' ');
Output:
sss[0] - rajan
sss[1] - himachal
Marimuthu ArigovindasamyRank #5,893 · 283 reputationPosted Jun 15, 2010, 4:17 PM EDT
string strInput = "Aaaa Bbbbb Ccccc Dddddd";
string[] strSplit = strInput.Split(' ');
int arrayCount = strSplit.Length;
for (int i = 0; i < arrayCount; i++)
{
MessageBox.Show(strSplit[i].ToString());
}
Have u solved the pbm?
Marimuthu ArigovindasamyRank #5,893 · 283 reputationPosted Jun 17, 2010, 6:02 PM EDT