mIRC Home    About    Download    Register    News    Help

Print Thread
#94139 14/08/04 08:21 AM
Joined: Apr 2004
Posts: 5
C
cul Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
C
Joined: Apr 2004
Posts: 5
I want to remove all the character from a var without the abc, ABC, 123, so thing like "HELLO smile how do you do ?!?!?!?" should be "HELLO how do you do"

123 = $chr(48 to 57)
ABC = $chr(65 to 90)
abc = $chr(97 to 122)

I tried it with a while loop but I can't get that fixed

#94140 14/08/04 08:58 AM
Joined: Dec 2002
Posts: 788
C
Hoopy frood
Offline
Hoopy frood
C
Joined: Dec 2002
Posts: 788
You can do, $remove(string,!,",£,$,%) ect.

but if you want a loop.

alias strstrip {
var %i = $len($1-)
var %str = $1-
while (%i) {
var %c = $asc($mid(%str,%i,1))
if (((48 > %c) && (%c != 32)) || ((%c > 57) && (%c < 65)) || ((%c > 90) && (%c < 97)) || (%c > 122)) {
var %str = $remove(%str,$chr(%c))
}
dec %i
}
echo -a -> %str
}


syntax; /strstrip the text goes here.

Eamonn.

#94141 14/08/04 09:26 AM
Joined: Apr 2004
Posts: 5
C
cul Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
C
Joined: Apr 2004
Posts: 5
I'm sorry - but how to put this in a script laugh

set %msg strstrip %msg won't work .... laugh

#94142 14/08/04 01:57 PM
Joined: Apr 2003
Posts: 701
K
Hoopy frood
Offline
Hoopy frood
K
Joined: Apr 2003
Posts: 701
alias clean {
var %result, %q = $regsub($1-,/[^a-z0-9 ]/giS,,%result)
echo -a removed %q characters (after stripping color and other control codes)
echo -a cleaned-up text: %result
}
[color:green]; put above in remotes (press alt-r twice) then type command below in an editbox somewhere

/clean 4hel(çlo!!!" §çé!the觧èreééé'
[/color]
it should print out:
removed 18 characters (after stripping color and other control codes)
cleaned-up text: hello there

This should get you started, it removes everything but a-zA-Z0-9 and space.


Link Copied to Clipboard