Devide String

Aquí puedes preguntar o compartir tus dudas y conocimientos acerca del programa
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"

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)


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.
sorry pabloko but cant understand it.. :sorry:
i dont know how to call it...
function DelimitedStringToTable(DelimitedString, Delimiter)
	tbReturn = {};
	local strWorking;
	local nPos = nil;
	local strData;
	local nTableIndex = 1;
	local nDelimiterLength = String.Length(Delimiter);
	if(nDelimiterLength < 1)then
		tbReturn[nTableIndex] = DelimitedString;
		return tbReturn;
	strWorking = DelimitedString;
	nPos = String.Find(strWorking,Delimiter);
	while(nPos ~= -1)do
		strData = String.Left(strWorking,nPos-1);
		tbReturn[nTableIndex] = strData;
		nTableIndex = nTableIndex + 1;
		local nLength = String.Length(strWorking);
		strWorking = String.Right(strWorking,nLength - (nPos + (nDelimiterLength-1)));
		nPos = String.Find(strWorking,Delimiter);
	if(strWorking ~= "")then
		tbReturn[nTableIndex] = strWorking;
	return tbReturn;

local string = ("U|MOM|LIKE|MAH_DICK");

for _, string in pairs(DelimitedStringToTable(string, "|"))do
Dialog.Message("penispenispenis", string);

probablemente poner string no sea buena idea... :gtfo-1414026923:
@NikolasG thank you...