mIRC Home    About    Download    Register    News    Help

Print Thread
remove a line in a variable that doesnt start # #109404 29/01/05 07:37 AM
Joined: Jan 2005
Posts: 5
H
hirayz Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
H
Joined: Jan 2005
Posts: 5
hey how can i remove lines from my variable that does not start with a #

#rgwgihwg
#wqeignwginp
wqeginwqgn
#wqingg
#wkgnnkpgw

i want to remove "wqeginwqgn"
and then only have

#rgwgihwg
#wqeignwginp
#wqingg
#wkgnnkpgw

left

how can i do that ?

Re: remove a line in a variable that doesnt start # #109405 29/01/05 08:23 AM
Joined: Sep 2003
Posts: 4,230
D
DaveC Offline
Hoopy frood
Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
Im gonna assume you have them all in one variable seperated by spaces.

var %varablename = $remove.non.hashed(%varablename)

Code:
alias remove.non.hashed {
  var %t
  tokenize 32 $1-
  while ($1) {
    if (#* iswm $1) { var %t = %t $1 }
    tokenize 32 $2-
  }
  return %t
}

Re: remove a line in a variable that doesnt start #109406 29/01/05 08:33 AM
Joined: Jan 2005
Posts: 5
H
hirayz Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
H
Joined: Jan 2005
Posts: 5
no they are seperated by "line feed" or what its called in eng.

like i wrote them
#wpgiwp
#rwijgipg
#wpigpigw
ewjigopog
#owrgo

not
#wrngpin #wepipgiw #pijwgpig pingigw #ipwegpig
like that

Re: remove a line in a variable that doesnt start #109407 29/01/05 08:35 AM
Joined: Jan 2005
Posts: 5
H
hirayz Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
H
Joined: Jan 2005
Posts: 5
ahhh but it works anyway

thanks

Re: remove a line in a variable that doesnt start #109408 29/01/05 08:37 AM
Joined: Jan 2005
Posts: 5
H
hirayz Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
H
Joined: Jan 2005
Posts: 5
now it do laugh

alias remove.non.hashed {
var %t
tokenize 13 $1-
while ($1) {
if (#* iswm $1) { var %t = %t $1 }
tokenize 13 $2-
}
return %t
}

Last edited by hirayz; 29/01/05 08:46 AM.
Re: remove a line in a variable that doesnt start #109409 29/01/05 08:13 PM
Joined: Sep 2003
Posts: 4,230
D
DaveC Offline
Hoopy frood
Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
13 is cariage return /help $cr
10 is line feed /help $lf

Sounds like it might have worked by chance likely there is #blah<space><cariage return> maybe not, The second "tokenize 13" should have caused it to go astray since the first one would have sepearted it on 13's but replaced them with spaces.

Try out.


var %varablename = $remove.non.hashed(%varablename)

Code:
alias remove.non.hashed {
  var %t = $1-
  var %i = $numtok(%t,13)
  while (%i) {
    if (#* !iswm $gettok(%t,%i,13)) { var %t = $deltok(%t,%i,13) }
    dec %i
  }
  return %t
}

Re: remove a line in a variable that doesnt start #109410 30/01/05 05:11 AM
Joined: Jan 2005
Posts: 5
H
hirayz Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
H
Joined: Jan 2005
Posts: 5
thanks