gjoisa Active Member Licensed User Longtime User Aug 15, 2012 #1 I can't find string split function . How to get it ? for eg: Code: Copy dim temp as string dim rst() as string temp = "Ravi,Hari,Raman,Anitha,Vinod" rst = Split(temp,",") Actually array variable rst shoud get splitted strings from temp . P.S: Last line in code does not work .
I can't find string split function . How to get it ? for eg: Code: Copy dim temp as string dim rst() as string temp = "Ravi,Hari,Raman,Anitha,Vinod" rst = Split(temp,",") Actually array variable rst shoud get splitted strings from temp . P.S: Last line in code does not work .
M Merlot2309 Active Member Licensed User Longtime User Aug 15, 2012 #2 Hi, Regex should do it, see: Basic4android - Regular Expressions (Core) Success, Helen. Upvote 0
Olaan Expert Licensed User Longtime User Aug 17, 2012 #3 gjoisa said: I can't find string split function . How to get it ? for eg: Code: Copy dim temp as string dim rst() as string temp = "Ravi,Hari,Raman,Anitha,Vinod" rst = Split(temp,",") Actually array variable rst shoud get splitted strings from temp . P.S: Last line in code does not work . Click to expand... Example: Dim components() As String components = Regex.Split(",","abc,def,,ghi") 'returns: "abc", "def", "", "ghi" components(0)="abc" components(1)="def" components(2)="" components(3)="ghi" Last edited: Aug 17, 2012 Upvote 0
gjoisa said: I can't find string split function . How to get it ? for eg: Code: Copy dim temp as string dim rst() as string temp = "Ravi,Hari,Raman,Anitha,Vinod" rst = Split(temp,",") Actually array variable rst shoud get splitted strings from temp . P.S: Last line in code does not work . Click to expand... Example: Dim components() As String components = Regex.Split(",","abc,def,,ghi") 'returns: "abc", "def", "", "ghi" components(0)="abc" components(1)="def" components(2)="" components(3)="ghi"
C cbal03 Active Member Licensed User Longtime User Oct 10, 2012 #4 Split appears to behave incorrectly Dim strVersion As String Dim lstVersions As List strVersion = "1,0,0a" lstVersions = Regex.Split(",",strVersion) 'list items seperated by comma. Log("Split version: " & strVersion) 'show original string Log(lstVersions) 'show list contents output: (ArrayList) [1, 0, 0a] The above works fine. However when I use a dot for the seperating text the list isn't filled. Like below. Dim strVersion As String Dim lstVersions As List strVersion = "1.0.0a" lstVersions = Regex.Split(".",strVersion) 'list items seperated by dot. Log("Split version: " & strVersion) 'show original string Log(lstVersions) 'show list contents - LIST IS EMPTY? output: (ArrayList) [] Thanks in advance! Last edited: Oct 10, 2012 Upvote 0
Split appears to behave incorrectly Dim strVersion As String Dim lstVersions As List strVersion = "1,0,0a" lstVersions = Regex.Split(",",strVersion) 'list items seperated by comma. Log("Split version: " & strVersion) 'show original string Log(lstVersions) 'show list contents output: (ArrayList) [1, 0, 0a] The above works fine. However when I use a dot for the seperating text the list isn't filled. Like below. Dim strVersion As String Dim lstVersions As List strVersion = "1.0.0a" lstVersions = Regex.Split(".",strVersion) 'list items seperated by dot. Log("Split version: " & strVersion) 'show original string Log(lstVersions) 'show list contents - LIST IS EMPTY? output: (ArrayList) [] Thanks in advance!
klaus Expert Licensed User Longtime User Oct 10, 2012 #5 You must use: Code: Copy lstVersions = Regex.Split("\.",strVersion) beccause the dot is a special character in Regex. Best regards. Upvote 0
You must use: Code: Copy lstVersions = Regex.Split("\.",strVersion) beccause the dot is a special character in Regex. Best regards.