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.

Spliting stuff..

Old posts that have not been replied to for several years.
Locked
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

Hi,
need a sugestion for how to split the next stuff..
I got this line: "arg1 arg2 arg3 arg4 arg5" and I want to make this line without "arg3". I was thinking to use some split from first arg to arg 3 and hen from arg 3 to the end. Any oher sugestion for this?

Thx!
User avatar
stdragon
Owner
Posts: 959
Joined: Sun Sep 23, 2001 8:00 pm
Contact:

Post by stdragon »

You can do it pretty simply with regsub.

regsub {(.* .* ).* (.* .* .*)} $line {12} newline

You can also do it pretty simply with lreplace.

set newline [join [lreplace [split $line] 2 2]]
P
Petersen
Owner
Posts: 685
Joined: Thu Sep 27, 2001 8:00 pm
Location: Blackpool, UK

Post by Petersen »

blah, stdragon replyed same time as me with much better solution than me (actually i did think about it, but couldnt be bothered working out the regsub :razz: )

<font size=-1>[ This Message was edited by: Petersen on 2002-03-05 04:41 ]</font>
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

Hi, give me a clue about "regsub" stuff pls. With the spliting part I can manage preaty good now, or I think i do. :smile: Thx!
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

Me again! :smile:
I found some clues about this regsub and made this nice code:

set args "arg1 arg2 arg3 arg4 arg5"

bind pub * !chk chk_chan

proc chk_chan {nick host handle chan arg} {
regsub -all "arg3" $list "" list
putserv "PRIVMSG $chan :$list"
}

Cool man! works great. Thx for the tip. :smile:
Locked