0

i am creating a small cpu simulator and i need to parse the assembly instruction which is like "add $s1 $s2 $s3", i need to get these four individual words ignoring the white spaces, if i use string.split(' '), it wont work if user enters more than one space between the words. i think of implementing it using subscript, but there should be easier way.
any ideas?

2
Contributors
6
Replies
7
Views
7 Years
Discussion Span
Last Post by serkan sendur
0

Try str.Split(new char[] {' '}, StringSplitOptions.RemoveEmptyEntries); .

if that works i will kiss you on your forehead.

0

wow it worked :

string something = "ali veli      deli";
        string[] somethings = something.Split(new char[]{' '}, StringSplitOptions.RemoveEmptyEntries);

        Response.Write(somethings.Length.ToString());

the output is 3 as expectedly.
now the question for you, how were you able to find this information?

0

i found it :

foreach (DataGridViewRow dr in DataGridName.SelectedRows)
{
  dr.Selected = false;
}
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.