| View previous topic :: View next topic |
| Author |
Message |
Jag Halfop
Joined: 19 Sep 2003 Posts: 90
|
Posted: Sun Mar 21, 2004 2:32 pm Post subject: lreplace question |
|
|
I have the line:
How can i replace these lines to be:
With the [lreplace] command?
I have read the manual of this command, but i didn't understand.
Hope that you'll help me, thanks  |
|
| Back to top |
|
 |
Rusher2K Halfop

Joined: 18 Apr 2003 Posts: 88 Location: Germany
|
Posted: Sun Mar 21, 2004 3:10 pm Post subject: |
|
|
You can use that :
| Code: | set code "1.2.3.4"
set code [string map {. *} 1.2.3.4.5] ; return $code
that returns : 2 - result: 1*2*3*4*5 - clicks: 109
|
Or that :
| Code: | set code "1.2.3.4"
regsub -all -- {\.} $code * code ; return $code
that returns : 2 - result: 1*2*3*4*5 - clicks: 416 |
_________________ ISP4Player = Internet Service Provider 4 Player
German Top Hoster. |
|
| Back to top |
|
 |
Jag Halfop
Joined: 19 Sep 2003 Posts: 90
|
Posted: Mon Mar 22, 2004 8:28 am Post subject: |
|
|
Thanks, it works!
last question, how can i regsub all the colors/bolds/italics (\003,\002\037) from line?
Thanks again  |
|
| Back to top |
|
 |
GodOfSuicide Master

Joined: 17 Jun 2002 Posts: 463 Location: Austria
|
Posted: Mon Mar 22, 2004 9:14 am Post subject: |
|
|
| Code: |
proc stripcolors { text } {
regsub -all -- {\003[0-9]{0,2}(,[0-9]{0,2})?|\017|\037|\002|\026} $text {} text
return $text
}
|
|
|
| Back to top |
|
 |
arcane Master

Joined: 30 Jan 2003 Posts: 280 Location: Germany
|
Posted: Mon Mar 22, 2004 10:56 am Post subject: |
|
|
or another version:
| Code: |
set code "1.2.3.4"
set code [join [split $code .] *]
|
_________________ aVote page back online!
Check out the most popular voting script for eggdrop bots.
Join the metal tavern! |
|
| Back to top |
|
 |
Jag Halfop
Joined: 19 Sep 2003 Posts: 90
|
Posted: Mon Mar 22, 2004 11:25 am Post subject: |
|
|
Thank you all  |
|
| Back to top |
|
 |
user

Joined: 18 Mar 2003 Posts: 1452 Location: Norway
|
Posted: Fri Mar 26, 2004 6:25 am Post subject: I've said this before... |
|
|
| GodOfSuicide wrote: | | Code: | | regsub -all -- {\003[0-9]{0,2}(,[0-9]{0,2})?|\017|\037|\002|\026} $text {} text |
|
That's not the right way to match colors. It would match things like "\003," "\003,99" "\00366," where "," and "99" are not part of the color "tag". Try this instead:
| Code: | | regsub -all {\002|\003([0-9]{1,2}(,[0-9]{1,2})?)?|\017|\026|\037} $text {} text |
_________________ Have you ever read "The Manual"? |
|
| Back to top |
|
 |
|