mIRC Home    About    Download    Register    News    Help

Print Thread
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
#wqeignwgåinp
wqeginwqgnå
#wqingåg
#wkgnnkpgw

i want to remove "wqeginwqgnå"
and then only have

#rgwgihwg
#wqeignwgåinp
#wqingåg
#wkgnnkpgw

left

how can i do that ?

Joined: Sep 2003
Posts: 4,230
D
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
}

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

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

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.
Joined: Sep 2003
Posts: 4,230
D
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
}

Joined: Jan 2005
Posts: 5
H
hirayz Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
H
Joined: Jan 2005
Posts: 5
thanks


Link Copied to Clipboard