TCL使用format命令进行字符串的格式化,功能与ANSI C中的sprintf函数相似。例如:format "The square root of 10 is%.3f" [expr sqrt(10)]The square root of 10 is 3. 162format的第一个参数是格式字符串,其中可以包含任意多个像%.3f这样的转换符。针对每一个转换符,format会按照其格式替换后面表达式或参数的值。format基本上...
在TCL可以使用命令string is来判断一个字符串的类型。如果它是指定类型的字符串,就返回1,否则返回0。例如:string is digit 12341string is digit "A man, a plan acanal. Panama."0默认情况下,如果字符串为空,对任何类型string is都返回1。使用-strict选项可以强制要求在字符串为空时string is返回0。string is co...