Official Soldat Forums

Server Talk => Scripting Discussions and Help => Topic started by: Norbo on November 10, 2008, 02:22:38 pm

Title: keydon xplit?
Post 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.
Title: Re: keydon xplit?
Post by: GSx_Major on November 10, 2008, 03:23:04 pm
It splits a string into an array...

xsplit('a;b;c;d', ';') would give an array with 'a', 'b', 'c' and 'd'.
Title: Re: keydon xplit?
Post by: chutem on November 10, 2008, 11:37:54 pm
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)
Title: Re: keydon xplit?
Post by: danmer on November 11, 2008, 06:19:24 am
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
Title: Re: keydon xplit?
Post by: danmer on November 11, 2008, 06:23:10 am
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
Title: Re: keydon xplit?
Post by: BombSki on November 11, 2008, 07:58:55 am
concerning out of range, ill just throw this link in:
http://bombski.bendaweb.com/c-s/index.php?topic=62.0

Quote
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.