Page 1 of 1

STRING ARGUMENTS HELP!!

Posted: 2010-04-18 19:34:02
by xinxilas
Hellooooo!

123,456,789

How can i get the valour of the "FISRT,SECOND" (123456) arguments and "THIRD" (789) argument

tile = 123,456,789
i want:
fs = 123456
t = 789

Thanks to all!

Re: STRING ARGUMENTS HELP!!

Posted: 2010-04-18 21:22:03
by Beyonder
Something like this:

Code: Select all

sub test()
	var string="123,456,789"
	dim resArray[3]
	Split(string,",",resArray)
	var a = resArray[0]+resArray[1]
	var b = resArray[2]
endsub

Sub Split(string,delim,sArray)
	var LastAdd = 1
	var tempString = "";
	var i

	for i = 0 to Len(string)
	   If not string[i] == delim then
		  tempString = tempString + string[i]
	   End if
	   If string[i] == delim or Len(string) == i then
		  If not tempString == "" then
			 sArray[LastAdd] = tempString
			 tempString = "";
			 LastAdd = LastAdd + 1
		  End if
	   End if	   
	next
	sArray[0] = LastAdd - 1
	return sArray
End sub