This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

replace part of string

Old posts that have not been replied to for several years.
Locked
a
asmds

replace part of string

Post by asmds »

hi im tryng to read a line from a text file with my eggdrop but i have a problem with that, i need to take off a part of the string

for example ( in my text file ):

http://www.xsecurity.ws/modules.php?op=modload & amp ; name=News & amp ; file=article & amp ; sid=1678



i need it like this

http://www.xsecurity.ws/modules.php?op= ... e&sid=1678

Can someone help me ?

Tks :) keep up the good work
p
pollar
Voice
Posts: 18
Joined: Thu Jan 09, 2003 12:20 pm
Location: Lithuania

Post by pollar »

Try this:

Code: Select all


proc removeamp {string} {
  regsub -all "amp;" $string "" string
  return $string
}
p
pollar
Voice
Posts: 18
Joined: Thu Jan 09, 2003 12:20 pm
Location: Lithuania

Post by pollar »

A little correction :)


Code: Select all


proc removeamp {string} { 
  regsub -all " " $string "" string
  regsub -all "amp;" $string "" string 
  return $string 
} 

a
asmds

me again

Post by asmds »

Thats :))

Very quick answer ehehe

but help me here with something please

this is my script:

bind pub o|o !news pub:msg:ver:news
proc pub:msg:ver:news {nick uhost hand chan arg} {

global botnick
putlog "NeWS"
set file [open "/home/sergio/new.txt" r]
while {![eof $file]} {
"PRIVMSG $chan : \002 [gets $file] \002"
}
close $file
}


where do i put your code ?

tks :)
a
asmds

my script

Post by asmds »

it doesn't work :(

Help me :)

bind pub o|o !news pub:msg:ver:news
proc pub:msg:ver:news {nick uhost hand chan arg} {

global botnick
putlog "NeWS"
set file [open "/home/sergio/new" r]

set line [gets $file]

if {[string match "*amp;*" $line]} {
puthelp "PRIVMSG $chan : \002 [removeamp $line] \002"
} else {
puthelp "PRIVMSG $chan : \002 $line \002"
}


proc removeamp {string} {
regsub -all " " $string "" string
regsub -all "amp;" $string "" string
return $string
}
Locked