Is it possible to save value of txtSearche in array splitted into seperate words?
txtSearche = "put returns between paragraphs";
something like this:
StringBuilder sb = new StringBuilder(txtSearche);
array1 = sb[1] = put
array2 = sb[2] = returns
array3 = sb[3]
array4 = sb[4]
array5 = sb[5]
how to do it correct?
Yes try this:
which will give you:
EDIT: Also as Adkins mentions below, the words array will be created to whatever size is needed by the string that is provided. If you want the list to have a dynamic size I would say drop the array into a list using List wordList = words.ToList();
EDIT: Nakul to split by one space or more, just add them as parameters into the
Split()method like below:or you can tell it simply to split by a single space and ignore entries that are blank, caused by consecutive spaces, by using the
StringSplitOptions.RemoveEmptyEntriesenum like so