Introduction Updated, new $explode feature.
Serves the same purpose as the PHP explode() function.
Syntax:
No screenshot available
; -------------------------------
; Improved Regsubex version
alias explode {
; syntax:/explode [charval_to_seperate] [text_to_explode]
; or: $explode(text_to_explode).Charval_to_seperate
; exploded text is set to %explode with /explode
; exploded text returned if $explode is used
; ---
var %tx = $iif($isid,$1-,$2-), %cn = $iif($isid,$prop,$1)
if (%cn !isnum 1-255) $iif($isid,return,echo -a) 2* $+($iif($isid,$,/),explode:) error. invalid paramaters
else $iif($isid,return,set %explode) $left($regsubex(%tx,/(.)/g,$+(\t,$chr(%cn))),-1)
}
; OLD EXPIRED VERSION - HERE FOR REFERENCE
; --------------------------
; While loop version
alias explode {
; syntax:/explode [text_to_explode] [charval_to_seperate]
; exploded text is set to %explode
; ---
if ($gettok($1-,$0,32) !isnum 1-255) { echo -a 2* /explode: error syntax:/explode texttoexplode [chrvaltoseperate] }
unset %explode | var %x = 1
while (%x <= $len($1)) { set %explode %explode $+($mid($1,%x,1),$chr($gettok($1-,$0,32))) | inc %x }
}
;---------------------------
Oh i thought it litrally split the text up like the pphp does into arrays but all it seems to be doing for me is putting in aload of spaces (and because i wanted to separate -) and aload of - in there too.
Serves the same purpose as the PHP explode() function.
What i usually use the explode function on php is to split a sting into chunks into an array using the character you specify, kind of like tokenize in mirc.
And i just realised, why the fudge dont i just use tokenize
of course, it's the main other language i use, even though i hardly do it these days.
I used to code mIRC a long time ago. but, i really don't see the point in applying all that time and effort into a language thats of no use outside of mIRCLAND. Thats just my opinion though. Not trying to get on anyones tits. :P