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..................
Loading
Marimuthu ArigovindasamyPosted Jun 17, 2010, 10:02 PM
Marimuthu ArigovindasamyPosted Jun 15, 2010, 8:17 PM
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 ArigovindasamyPosted Jun 15, 2010, 12:20 AM
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