Lots of times we want to split strings based on white space but we have to write extra code to ensure that there are no multiple white spaces. Splitting a string with consecutive multiple white spaces returns an array with empty string(s).
One can avoid writing extra code by simply using the function Regex.Split in the System.Text.RegularExpression namespace. This function Splits the specified input string at the positions defined by a regular expression pattern.
The VB.Net code would look something like this:
Dim
arrWords() As String = _
System.Text.RegularExpressions.Regex.Split(strPhrase, "\s+")
Thank you! Thank you! I just finished reading this document, which was part of a link in the recent Buzz newsletter. I have printed it for others to read, especially those skeptical on the powers of Access and its capabilities.
Darren D.
All Our Microsoft Access Products