You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to
I have the need to increment characters, which is not accepted as valid Tcl code. If the variable x contains the letter 'a', I would like to increment it to 'b' and so on. In C this is no problem, in Pascal there is the succ() function, but how can I do this in Tcl without writing a C function, which would be too much of a hassle, because I want to use my script under UniX and Windows, and I lack a C compiler for Windows.
ThanX in advance
Holger
Hume Smith
unread,
May 30, 1999, 3:00:00 AM5/30/99
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to
Holger <hol...@2die4.com> wrote: >I have the need to increment characters, which is not accepted as >valid Tcl code. If the variable x contains the letter 'a', I would like >to increment it to 'b' and so on
off the top o me head - disgusting
proc cincr {var {val 1}} { upvar 1 $var x if {1==[scan $x %c y]} { set x [format %c [incr y $val]] } }
you may be better keeping an integer, applying incr to that, and using format.