Example
mystring = "a b c d"
var = split(mystring," ")
So var(0) would be a, 1 would be b, etc.|||Hi,
Blizz provide a function for doing this called 'strsplit'.
strsplit returns a list of values, and not a table
So :
Code:
mystring = "a b c d"
var1, var2, var3, var4 = strsplit(" ", mystring)
But you can use a nifty trick with curly brackets to place these values in a table automatically :
Code:
mystring = "a b c d"|||You want strsplit. See the example for how to get a table back from it (just wrap the return in a table declaration).
var = { strsplit(" ", mystring) }
print( var[1] )
EDIT: Telic beat me, had this window open for ages before replying :) .
No comments:
Post a Comment