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.
Help for those learning Tcl or writing their own scripts.
Danko
Voice
Posts: 18 Joined: Thu Mar 09, 2006 1:07 pm
Post
by Danko » Thu Mar 23, 2006 4:48 am
How can I change
second toupper before i write/echo/whatever to file/chan when using this?
Code: Select all
foreach {first second} [split $arg] {break}
or
Code: Select all
set first [lindex [split $arg] 1]
set second [lindex [split $arg] 2]
(I belive the first one is faster code than the last one, correct?)
Sir_Fz
Revered One
Posts: 3794 Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:
Post
by Sir_Fz » Thu Mar 23, 2006 1:39 pm
To convert
second to
topupper
Code: Select all
set second [string toupper $second]
And
Code: Select all
set first [lindex [split $arg] 1]
set second [lindex [split $arg] 2]
is different than
Code: Select all
foreach {first second} [split $arg] {break}
since the 2nd code takes the first and second words while the 1st takes the second and the third words. You need to start with index 0, so
first is [lindex [split $arg] 0] and
second is [lindex [split $arg] 1].