mIRC Home    About    Download    Register    News    Help

Print Thread
#91205 20/07/04 08:04 PM
Joined: Jul 2004
Posts: 1
T
TDG Offline OP
Mostly harmless
OP Offline
Mostly harmless
T
Joined: Jul 2004
Posts: 1
I want to compare two variables with each other, and then output the values that they have in common.

Is that possible?


Example:

%a aa bb cc dd ee
%b cc dd ff gg

output : cc dd


Tnx in advance!

#91206 20/07/04 09:04 PM
Joined: Dec 2002
Posts: 788
C
Hoopy frood
Offline
Hoopy frood
C
Joined: Dec 2002
Posts: 788
A simple solution might be this alias:

alias findcommon {
var %a = $1, %b = $2, %c = $3, %i = 1
while ($numtok($1,%c) >= %i) {
if ($istok($2,$gettok($1,%i,%c),%c)) {
var %d = %d $gettok($1,%i,%c)
}
inc %i
}
return %d
}


Syntax: $findcommon(%a,%b,32)

Where %a is your original string, %b is your string your checking to see if %a isin, and 32 is the 'seperator' ascii code, in this case 32 for a space.

Eamonn.


Link Copied to Clipboard