I am delimiting my data with the "//" as I am passing it up to my webservice. My webservice is splitting the data into an array like so:
myArray = al(i).ToString.Split("//")
Everything works great, however, if I pass in some data like this: 100/100 then that also gets split. Is there a way to make sure that only the "//" gets split?
The VB.Net compiler is converting your string into a Char
array and calling this overload.
Thus, it's splitting on either /
or /
.
You need to call the overload that takes a string
array, like this:
"100/100".Split(New String() { "//" }, StringSplitOptions.None)
Always, always use Option Strict.
With Option Strict
the original code produces an error, rather than choosing the unhelpful overload:
Error 1 Option Strict On disallows implicit conversions from 'String' to 'Char'.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With