Determine type of a variable in Tcl

前端 未结 6 2153
不思量自难忘°
不思量自难忘° 2020-12-08 23:34

I\'m looking for a way to find the type of a variable in Tcl. For example if I have the variable $a and I want to know whether it is an integer.

I have been using th

6条回答
  •  -上瘾入骨i
    2020-12-08 23:44

    For arrays you want array exists for dicts you want dict exists

    for a list I don't think there is a built in way prior to 8.5?, there is this from http://wiki.tcl.tk/440

    proc isalist {string} {
      return [expr {0 == [catch {llength $string}]}]
    }
    

提交回复
热议问题