Is there any code that is able to split a string based on given symbols, to determine the count of the sub strings, instead of using multiple splits?
a [b] # c
This is the string [This is the bracketed string] # This is the string after hash
in the above case, splitting by # and
This is the string
This is the bracketed string
This is the string after hash
How about the following expression?
arrStr = System.Text.RegularExpressions.Regex.Split(yourString,"[^\w\s]+").Where(Function(s) not String.IsNullOrWhiteSpace(s)).ToArray()
thanks! but can i know what is this [^\w\s]+" ?
[^xxxx] means not in xxx.
\w is word character and
\s is white space character.
[^\w\s] means all characters except word character and whitespace character. ≒ Special character.
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.