mIRC Home    About    Download    Register    News    Help

Print Thread
removing spaces from a variable #131610 02/10/05 01:42 AM
Joined: Oct 2005
Posts: 1
R
Revelation Offline OP
Mostly harmless
OP Offline
Mostly harmless
R
Joined: Oct 2005
Posts: 1
Code:
on 1:TEXT:!imdb *:# {
  set %search $remove($1-,!imdb )
  set %url http://www.imdb.com/find?s=tt;q= $+ %search
  %url = $remove(%url, ,)
...


when trying eg !imdb test
returns: http://www.imdb.com/find?s=tt;q= test

any ideas of removing that damn space?

Re: removing spaces from a variable #131611 02/10/05 02:21 AM
Joined: Apr 2005
Posts: 17
D
dreak Offline
Pikka bird
Offline
Pikka bird
D
Joined: Apr 2005
Posts: 17
It would be easier just to...

set %url http://www.imdb.com/find?s=tt;q= $+ $2-

its best to then replace the other spaces with %20

set %url http://www.imdb.com/find?s=tt;q= $+ $replace($2-,$chr(32),$+(%,20))

Re: removing spaces from a variable #131612 02/10/05 02:25 AM
Joined: Dec 2002
Posts: 1,245
M
MikeChat Offline
Hoopy frood
Offline
Hoopy frood
M
Joined: Dec 2002
Posts: 1,245
Code:
on 1:TEXT:!imdb *:# {
  set %url http://www.imdb.com/find?s=tt;q= $+ $$2-

and/or 

on 1:TEXT:!imdb *:# {
  set %url http://www.imdb.com/find?s=tt;q= $+ $replace($$2-,$chr(32),+)


though I dont know why you are setting the variable, unless it is going to be sent to an alias or something

var %var = data (local variable)
is often better than
set %var data (global variable)

Re: removing spaces from a variable #131613 02/10/05 02:28 AM
Joined: Jan 2005
Posts: 188
Brax Offline
Vogon poet
Offline
Vogon poet
Joined: Jan 2005
Posts: 188
First what is %url = $remove(%url, ,)
Did you mean var %url = $remove(%url, ,) ?

Why not to try with:
set %url http://www.imdb.com/find?s=tt;q= $+ $2-

-edit-
MikeChat you are too quick for me

Last edited by Brax; 02/10/05 02:30 AM.

echo -a $signature
Re: removing spaces from a variable #131614 02/10/05 07:04 AM
Joined: Sep 2003
Posts: 4,230
D
DaveC Offline
Hoopy frood
Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
not overly important but you dont need to use $$2- in there, $2- well do.

Re: removing spaces from a variable #131615 02/10/05 04:28 PM
Joined: Dec 2002
Posts: 1,245
M
MikeChat Offline
Hoopy frood
Offline
Hoopy frood
M
Joined: Dec 2002
Posts: 1,245
true, but its an easy way to keep someone from hitting you with the trigger but no data request.