I have founded an bug in the method Split of the library StringFunctions found in your forum.
This bug consist on this:
When you use the Function Split to Split Strings and use this carachter
( "|" ) (ASCII 124), as a the character for separating one string into its sub-strings, the method works splitting the string into individual characters. instead of sub-strings.
I'm not familiar with the implementation of StringFunctions. However if it is based on Regex.Split then the separator is a regular expressions string. This means that you need to escape the pipe character:
I've making examples using the "\|" character as the separator, and all the sub-strings generated are finished by the backslash character.
This is mi code used for testing your solution:
'+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Sub Globals
'These global variables will be redeclared each time the activity is created.
'These variables can only be accessed from this module.
Dim strSource = "-1.4985018\|52.4053273\|1983688820\|node"
Dim strDivisor = "\|"
Dim result As List
Dim sf As StringFunctions
End Sub
Sub Activity_Create(FirstTime As Boolean)
'Do not forget to load the layout file created with the visual designer. For example:
'Activity.LoadLayout("Layout1")
result.Initialize
As you can see, the sub-strings are followed by the BackSlash Character "\"
Then, the methods Split and Split2 (I've tried with both because both are in the StringFunctions Library) have a bug because the sub-strings should be Splitted without the separator.
Dim strSource As String = "-1.4985018,52.4053273,1983688820,node"
Dim strDivisor = ","
result.Initialize
result = sf.Split(strSource, strDivisor)
Log (result)
I´m not @jlucabe - the thread opener - but i will thank you for your answer. I must burn that into my brain cause i dont want to run into this trap ;-)
it should be
Dim strSource = "-1.4985018|52.4053273|1983688820|node"
And the split is with this: "\|"
If the source is like quoted then you need the split string like stevel05 suggested.
goddamn it, i was loosing my mind over this. should have known something was up with the |.
funny thing is, i tried ** at first and it also went berserk. (reworked the code since, so ... i can't vouch for this.)