Addo Well-Known Member Licensed User Longtime User Jul 7, 2019 #1 i have this following text Code: dim data as string = "Marten~Samuel~~~Martha~" dim parser() As String parser = Regex.Split("\~", data) i expect to get Length of 5 , but i got Length of 3 why the empty ~ doesn't count in the parser ?
i have this following text Code: dim data as string = "Marten~Samuel~~~Martha~" dim parser() As String parser = Regex.Split("\~", data) i expect to get Length of 5 , but i got Length of 3 why the empty ~ doesn't count in the parser ?
DonManfred Expert Licensed User Longtime User Jul 7, 2019 #2 Code: Dim data As String = "Marten~Samuel~~~Martha~" Dim parser() As String parser = Regex.Split("~", data) Log($"Splitted Size: ${parser.Length} "$) For i= 0 To parser.Length-1 Log($"Val #${i}=${parser(i)}"$) Next Logs a size of 5 like i was expecting where #2 and #3 are empty. *** Service (starter) Create *** ** Service (starter) Start ** ** Activity (main) Create, isFirst = true ** Splitted Size: 5 Val #0=Marten Val #1=Samuel Val #2= Val #3= Val #4=Martha ** Activity (main) Resume ** ** Activity (main) Pause, UserClosed = false ** ** Activity (main) Resume ** Click to expand... Upvote 0
Code: Dim data As String = "Marten~Samuel~~~Martha~" Dim parser() As String parser = Regex.Split("~", data) Log($"Splitted Size: ${parser.Length} "$) For i= 0 To parser.Length-1 Log($"Val #${i}=${parser(i)}"$) Next Logs a size of 5 like i was expecting where #2 and #3 are empty. *** Service (starter) Create *** ** Service (starter) Start ** ** Activity (main) Create, isFirst = true ** Splitted Size: 5 Val #0=Marten Val #1=Samuel Val #2= Val #3= Val #4=Martha ** Activity (main) Resume ** ** Activity (main) Pause, UserClosed = false ** ** Activity (main) Resume ** Click to expand...
Addo Well-Known Member Licensed User Longtime User Jul 7, 2019 #3 weird i think something wrong with my text formatting i was shocked Upvote 0