Changing "1,2,3" into an Int array

BlitzMax Forums/BlitzMax Beginners Area/Changing "1,2,3" into an Int array

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

Small problem with yours tonyg...there's 5 numbers but the length of myarray ends up being 4. Just has to take out the "-1" on this line:

Local myarray:Int[outstring.length-1]


Here's my final version and thanks to you both:
Local array%[] = StrToIntArray("1,2,3,4,5")

For i = 0 To array.length-1
	Print array[i]
Next

End

Function StrToIntArray%[](str$, sep$=",")
	Local strArray$[] = str.split(sep)
	Local intArray%[strArray.length]
	For Local i:Int = 0 To strArray.length-1
		intArray[i] = Int(strArray[i])
	Next
	Return intArray
End Function