Hi all,
im trying to separate words in a string using whitespace " ".
but it gives ArgumentOutOfRangeExeception
: Index and length must refer to a location within the string.
Parameter name: length
it points to this line : if (textBox3.Text.Substring(i,c)==" ")
if (textBox3.Text != null)
{
ArrayList arrayKeyword = new ArrayList();
int index = 0;
int c = 0;
for (int i = 0; i < textBox3.Text.Length;i++ )
{
c = i+1 ;
if (textBox3.Text.Substring(i,c)==" ")
{
string word = null;
word = textBox3.Text.Substring(0, i);
arrayKeyword[index]=word;
index = index + 1;
}
}
string pattern = null;
for (int i = 0; i < arrayKeyword.Count; i++)
{
pattern = "(\\w*"+arrayKeyword[i]+"\\w*)*";
}
MessageBox.Show(pattern);
PLZ help me.