I'm pretty new to vb.net and I don't understand why split works differently if separator is more then one character.
I've tryed this on .net fiddle and I was surprised from result:
Dim Txt as string = "123_|_ABC_|_sd"
Dim c() as string
c= Txt.Split("_|_")
console.WriteLine(c.length)
For i = 0 to c.length -1
console.WriteLine(c(i))
Next
Txt = "123|ABC|sd"
c= Txt.Split("|")
console.WriteLine(c.length)
For i = 0 to c.length -1
console.WriteLine(c(i))
Next
Result was, for first part of code:
5
123
|
ABC
|
sd
For the second part of code:
3
123
ABC
sd
My questions are: Why this happens? Is there a way to get result of 2nd part of code with a separator of multiple chars?