Author Topic: keydon xplit?  (Read 1040 times)

0 Members and 2 Guests are viewing this topic.

Offline Norbo

  • Camper
  • ***
  • Posts: 338
keydon xplit?
« 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.

Offline GSx_Major

  • Major
  • *
  • Posts: 97
Re: keydon xplit?
« Reply #1 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'.
...and headbutt the sucker through your banana suit!

Offline chutem

  • Veteran
  • *****
  • Posts: 1119
Re: keydon xplit?
« Reply #2 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)
1NK3FbdNtH6jNH4dc1fzuvd4ruVdMQABvs

Offline danmer

  • Camper
  • ***
  • Posts: 466
  • crabhead
Re: keydon xplit?
« Reply #3 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 [0], so if you setarraylength(myarray,1), dont try to access myarray[1], as you'll get an out of range error)

Offline danmer

  • Camper
  • ***
  • Posts: 466
  • crabhead
Re: keydon xplit?
« Reply #4 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

Offline BombSki

  • Flagrunner
  • ****
  • Posts: 927
    • Climbing-soldiers.net
Re: keydon xplit?
« Reply #5 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.