Reputation: 1566
I have this string which looks like this:
613 3503||0 82 1 49 1 1950 63543 11301 3 CORP-A1 1656.06 150 0 N 82.8 198.72 12.42 N 0 0 0 N Y 1
However, when I string split it by either TAB or SPACE, it does not split via Tab or space. It still outputs as the whole thing.
I tried the following:
= fromVisMtext.Text.Split(vbTab)
= fromVisMtext.Text.Split(" ")
Also, here at stack overflow when I pasted said string, it isn't delimited and is connected with each other.
6133503||0821491195063543113013CORP-A11656.061500N82.8198.7212.42N000NY1
The string I've pasted above was mine that I added white spaces manually, since here StackOverflow removes said delimiters.
Also, said string is from the VisM control of Intersystems Cache.
How can split this string by either Tab or Space? It doesn't seem to be either, but the data is definitely delimited by a white space or tab something.
EDIT here is the result of Dim theGlobals = String.Join(" ", fromVisMtext.Text.Select(Function(ch) Microsoft.VisualBasic.AscW(ch).ToString("x4")))
Upvotes: 2
Views: 3957
Reputation: 186668
In general case (space, tab, non breaking space etc. separators) you can try split by any white space, e.g.:
String source = @"613 3503||0 82 1 49 1 1950 63543 11301 3 CORP-A1 1656.06 150 0 N 82.8 198.72 12.42 N 0 0 0 N Y 1";
var result = Regex
.Split(source, @"\s")
.Where(item => !String.IsNullOrEmpty(item));
//.ToArray(); // <- if you want to materialize
// 613
// 3503||0
// 82
// 1
// ...
// N
// Y
// 1
Console.Write(String.Join(Environment.NewLine, result));
If you´re sure that separators can be space (' '
) or tab ('\t'
) only you can just split:
var result = source.Split(new Char[] { ' ', '\t' },
StringSplitOptions.RemoveEmptyEntries);
Upvotes: 1