Reply To: Tcl help: how do I identify a number?

Clovertech Forums Read Only Archives Cloverleaf Cloverleaf Tcl help: how do I identify a number? Reply To: Tcl help: how do I identify a number?

#58492
Jim Kosloskey
Participant

    Sam,

    The string Tcl command has many options. One of them is the ‘is class’ option. Do a help string in hcitcl to see all options etc.

    example:

    set junk abcdef

    string is digit -strict $junk

     —> returns a zero (not true)

    set stuff 12345

    string is digit -strict $stuff

      —> returns a one (true)

    set nonsense “”

    string is digit -strict $nonsense

      —> returns a zero (not true)

    Jim Kosloskey

    email: jim.kosloskey@jim-kosloskey.com 30+ years Cloverleaf, 60 years IT – old fart.