Advanced Search
Mail us
Home    Manuel    Links    Faq    Submit a tcl/tk Reference    Contact Us

    Some examples tcl/tk codes     Man of Bwidget     Man of blt     mkwidget screenshots     TkOgl     Video Demo real.

  use numbers with leading zeroes?
 Dave Morriss was recently having problems because he was trying
to do something like:

set index [expr [exec date +%W]%[llength $pop_server_list]]

but during the 9th and 9th week of the year, he got errors - 08 and 09
are not valid octal numbers in Tcl.

Some of the solutions provided were:

From George A. Howlett , we got:

set wknum [format "%g" [exec date +%W]]
set index [expr [exec $wknum%[llength $pop_server_list]]

From Fred Feirtag  :

set index [expr (1[exec date +%W]-100)%[llength $pop_server_list]]

From Dan R. Schenck :

set index [expr [string trimleft [exec date +%W] 0]%[llength $pop_server_list]]