I'm not sure I quite understand the question, but you can use the Left(), Right() or Mid() functions to get a subset of a given string taken from the left, right or middle of a string.
<pre>Dim subString as String
subString = Left("One two three", 3) ' subString = "One"
subString = Right("One two three", 5) 'subString = "three"
subString = Mid("One two three", 5, 3) 'subString = "two"
subString = Mid("One two three", 5) 'subString = "two three"</pre>
You can use InStr() or InStrRev() to get the first or last occurrence of one string in another. So your end code may be something like:
<pre>
Dim bigString as String
Dim leftString as String
Dim rightString as String
Dim splitAt as Integer
bigString = "hello world"
splitAt = InStr(bigString, "world") ' splitAt = 7
leftString = Left(bigString, splitAt-1) ' leftString = "hello "
' (note the space after "hello")
rightString = Mid(bigString, splitAt) ' rightString = "world"</pre>
In flavours of visualo basic .NET you can use the Split function. It normally splits a string into substrings based on the space character as separator but, assuming your <null> implies the need to use chr(0) as separator, this is easily done.
The following code gives the hint:
Dim TheString As String = "First" + vbNullChar.ToString() + "Thing" Dim TheArray As String() = Split(TheString, vbNullChar)TheArray.Length will now, correctly, be 2 and TheArray(0) will be “First” and TheArray(1) will be “Thing”.
The use of two <null> consecutively as in your answer will lead to production of an intervening empty string(string of length zero) in the output array.