Official Soldat Forums
Server Talk => Scripting Discussions and Help => Topic started by: Norbo on November 10, 2008, 02:22:38 pm
-
Can someone explain to me what this xsplit function does and how to use it?
I'm just curious, and it might be usefull, but i don't know what it does.
Thanks.
-
It splits a string into an array...
xsplit('a;b;c;d', ';') would give an array with 'a', 'b', 'c' and 'd'.
-
I have a little question too, is TStringArray a built in variable type.
And how can you change the 'height' of an array, like is there anything like SetArrayHeight(Array,height)
-
I have a little question too, is TStringArray a built in variable type.
And how can you change the 'height' of an array, like is there anything like SetArrayHeight(Array,height)
tstringarray behaves like array of string from what i noticed, dunno if they have any differences.
setarraylength is your friend here (they always start from - , so if you setarraylength(myarray,1), dont try to access myarray[1], as you'll get an out of range error)
-
Can someone explain to me what this xsplit function does and how to use it?
I'm just curious, and it might be usefull, but i don't know what it does.
Thanks.
people also use it to split text files into rows etc (i tried loading configs with it - much faster than using readini() a hundred times), but if used too often it can lead to exceptions - talk to Spkka and sai`ke if you're curious - they had some fighting with it
-
concerning out of range, ill just throw this link in:
http://bombski.bendaweb.com/c-s/index.php?topic=62.0
When I used xSplit I found out that it didn't work for 100%. It gave much runtime errors (out of range) when I used it so I remade the function. The function works the same, but begins at 0. It looks if the needle is in the back (in case of a file), if true it deletes it. It returns the array length as iArray so you don't need to use arrayhigh or getarraylenth.