Ahh, yeah, then it's basically as techgnome said, you're going to have to loop through every last character, and increment a counter if the current char you're on, is not a whitespace.
EDIT: Actually no... i've got a better idea, using LINQ you can probably select an index based on a current position as a starting index, and count off where to leave off, based on where the index is in the string if you count off how many chars you want
EDIT: Testing:
vb Code:
Dim str As String = "1 2 3 4 5"
Dim startpos As Integer = 0
Dim NonSpaceCount As Integer = 3
Dim x As Integer = str.IndexOf(str.First(Function(i) str.Substring(0, str.IndexOf(i)).Count(Function(c) Not Char.IsWhiteSpace(c)) = NonSpaceCount))
Console.WriteLine(str.Substring(startpos, x))
Wow that's creative lol... Can't believe I came up with that. This will output "1 2 3". What my code does here, using LINQ, is it will find the first index of a char where from the start index position to whatever char it's checking, that substring value contains x number of chars where the char is not a whitespace value. This is interpretted based off of NonSpaceCount, and the start index for this demonstration is indicated by startpos here.
We can keep NonSpaceCount the same, but in order to make use of this for what you're trying to do here, we're going to have to change the startpos variable accordingly. This is actually really cool. The way i've designed this LINQ expression. Errorhandling is still possibly required here for bad input data, although this does work :)
EDIT: Actually this is PERFECT... As we loop through until the end of the string, we can keep grabbing substrings using my LINQ example here, and for each time probably just make the value of x, our new startpos value.
I have yet to test, but it makes sense in my head right now.