mIRC Homepage
Posted By: Revelation removing spaces from a variable - 02/10/05 01:42 AM
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?
Posted By: dreak Re: removing spaces from a variable - 02/10/05 02:21 AM
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))
Posted By: MikeChat Re: removing spaces from a variable - 02/10/05 02:25 AM
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)
Posted By: Brax Re: removing spaces from a variable - 02/10/05 02:28 AM
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
Posted By: DaveC Re: removing spaces from a variable - 02/10/05 07:04 AM
not overly important but you dont need to use $$2- in there, $2- well do.
Posted By: MikeChat Re: removing spaces from a variable - 02/10/05 04:28 PM
true, but its an easy way to keep someone from hitting you with the trigger but no data request.
© mIRC Discussion Forums