S select Member Licensed User Longtime User Apr 26, 2014 #1 Hello, I've this problem. I'm trying to split a string (obtained from a sql sentence) in two variables. The values in the string are separated by comma, something like: Code: Copy "Car ,Red " I would like to enter "Car" in a variable "A" and "Red" in a variable "B". I tried with "regex.split" without success. Does anyone know how to do this? tnx
Hello, I've this problem. I'm trying to split a string (obtained from a sql sentence) in two variables. The values in the string are separated by comma, something like: Code: Copy "Car ,Red " I would like to enter "Car" in a variable "A" and "Red" in a variable "B". I tried with "regex.split" without success. Does anyone know how to do this? tnx
Erel B4X founder Staff member Licensed User Longtime User Apr 26, 2014 #2 Code: Copy Dim s() As String = Regex.Split(",", your string here) a = s(0).Trim b = s(1).Trim Upvote 0
A Andrew Gray Member Licensed User Longtime User Jun 5, 2015 #3 What if you want to split a string into ONLY two? Is there a function that would take "car, red, vintage, diesel" and return "car" in one variable and "red, vintage, diesel" in the other? Upvote 0
What if you want to split a string into ONLY two? Is there a function that would take "car, red, vintage, diesel" and return "car" in one variable and "red, vintage, diesel" in the other?
DonManfred Expert Licensed User Longtime User Jun 5, 2015 #4 Andrew Gray said: Is there a function Click to expand... No. But nobody stop you to create such a function. As you already know how to split a string it should be easy to build yourself a small helper-sub which splits a string and build two returnvalues. As a sub only can return one value i suggest using a list or a map as returnvalue. Upvote 0
Andrew Gray said: Is there a function Click to expand... No. But nobody stop you to create such a function. As you already know how to split a string it should be easy to build yourself a small helper-sub which splits a string and build two returnvalues. As a sub only can return one value i suggest using a list or a map as returnvalue.