Regex Slpit String

dadi4

Member
Licensed User
Longtime User
I have:

dim ar() as string
dim s as string
s="A|B|C||" ''''' D is messing and I assume I'll get: ar.length=4
a=Regex.Split("[|]",s)

I've got ar.length=3, why not got ar(3)="" ?
 

dadi4

Member
Licensed User
Longtime User
if we are talking about basic language it should not remove empty string
because I receive this data from server and sometimes it has empty string
 
Upvote 0

Mahares

Expert
Licensed User
Longtime User
I had a similar situation with a comma delimited text file that I was importing into a SQLite table. If the last item in the line is an empty string Regex cannot handle it well. Here is my workaround:
When I created the text file at the server level, I made sure to replace a null (empty) string with a string with 1 space in it like this: " " , in other words one space as a string to fool Regex, so it can parse it.
 
Upvote 0

dadi4

Member
Licensed User
Longtime User
I did the same in server side, but I think this is temp solution

maybe I have to write my own Split function
 
Upvote 0
Top