R
Raterus
Hello,
I'm trying to come up with an algorithm that will parse a search string, entered into a textbox. Basically it is not going to be too complicated, it will replace any delimeters the user puts in (comma's, semicolons, etc..) with spaces, essentially ignoring them, and then split the resultant string into a string array.
I've posted earlier about removing this extra whitespace that would be generated from the replace operation, so I can then split on " ", but now I'm wondering if there isn't an easier way to go about this. Removing this whitespace is really only needed to prep the string for the split function.
For example, say someone enters this
"bob, mary jane, sue; harry"
I want my final array to be this
bob
mary
jane
sue
NOT
bob
""
mary
jane
""
sue
""
harry
It would be like this if I didn't remove the extra spaces in the original string. This is the only way I really know how to do it right now, replace/remove extra whitespace
Does anyone have a better way of doing this?
Thanks!
--Michael
I'm trying to come up with an algorithm that will parse a search string, entered into a textbox. Basically it is not going to be too complicated, it will replace any delimeters the user puts in (comma's, semicolons, etc..) with spaces, essentially ignoring them, and then split the resultant string into a string array.
I've posted earlier about removing this extra whitespace that would be generated from the replace operation, so I can then split on " ", but now I'm wondering if there isn't an easier way to go about this. Removing this whitespace is really only needed to prep the string for the split function.
For example, say someone enters this
"bob, mary jane, sue; harry"
I want my final array to be this
bob
mary
jane
sue
NOT
bob
""
mary
jane
""
sue
""
harry
It would be like this if I didn't remove the extra spaces in the original string. This is the only way I really know how to do it right now, replace/remove extra whitespace
Does anyone have a better way of doing this?
Thanks!
--Michael