Devide String
Publicado: 02 Oct 2019 09:13
Hello i am posted in IR but no receiving response yet.
i have this code to separate the string is there any other ways to make it short or even simple?
example string is: x = "CAR-2015*TOYOTA|VIOS"
i am very limited on the code above, if you guys have more simple ways very much appreciated if you can share it to me. thank you.
i have this code to separate the string is there any other ways to make it short or even simple?
example string is: x = "CAR-2015*TOYOTA|VIOS"
nPipe = String.Find(x, "-", 1, false);
local sTemp = String.Mid(x, nPipe+1, -1);
local Type = String.Left(x, nPipe-1);
nPipe1 = String.Find(sTemp, "*", 1, false);
local sTemp1 = String.Mid(sTemp, nPipe1+1, -1);
local yModel = String.Left(sTemp, nPipe1-1);
local nTemp = String.Find(sTemp1, "|", 1, false);
local carBrand = String.Mid(sTemp1, nTemp+1, -1);
local carName = String.Left(sTemp1, nTemp-1);
Input.SetText("Input1", Type)
Input.SetText("Input2", yModel)
Input.SetText("Input3", carName)
Input.SetText("Input4", carBrand)
Output:
Input1 = CAR
Input2 = 2015
Input3 = TOYOTA
Input4 = VIOS
i am very limited on the code above, if you guys have more simple ways very much appreciated if you can share it to me. thank you.