string - Manipulate strings http://purl.org/tcl/home/man/tcl8.4/TclCmd/string.htm Ensembliform command for manipulating strings. ---- '''[string bytelength]''' ''string'' '''[string compare]''' ''?'''''-nocase'''''? ?'''''-length int'''''? string1 string2'' '''[string equal]''' ''?'''''-nocase'''''? ?'''''-length int'''''? string1 string2'' '''[string first]''' ''string1 string2 ?startIndex?'' '''[string index]''' ''string charIndex'' '''[string is]''' ''class ?'''''-strict'''''? ?'''''-failindex''' ''varname? string'' '''[string last]''' ''string1 string2 ?startIndex?'' '''[string length]''' ''string'' '''[string map]''' ''?'''''-nocase'''''? charMap string'' '''[string match]''' ''?'''''-nocase'''''? pattern string'' '''[string range]''' ''string first last'' '''[string repeat]''' ''string count'' '''[string replace]''' ''string first last ?newstring?'' '''[string reverse]''' ''string'' '''[string tolower]''' ''string ?first? ?last?'' '''[string totitle]''' ''string ?first? ?last?'' '''[string toupper]''' ''string ?first? ?last?'' '''[string trim]''' ''string ?chars?'' '''[string trimleft]''' ''string ?chars?'' '''[string trimright]''' ''string ?chars?'' '''[string wordend]''' ''string charIndex'' '''[string wordstart]''' ''string charIndex'' ---- Is this correct behavior? % set str "" % string is true $str 1 % string is false $str 1 % string is integer $str 1 % string is alpha $str 1 Sadly, yes, that is correct. You'll have to use the '''-strict''' option to keep empty strings from passing all tests. This is an unfortunate legacy from the origin of the [[string is]] command as a tool for [entry] validation, where it's important the empty string pass everything so that every input doesn't fail immediately. ---- *Using string functions for binary data* Is there a full documentation what of these functions are save to use with binary data? What I have found out so far: safe: * string range unsafe: * string index (at least ''string index $data end'' garbles $data) ---- See also: * [string forward compatibility] * [Additional string functions] * [string compare ...] ---- [Tcl syntax help] - [Arts and Crafts of Tcl-Tk Programming] - [Category Command] (of [Tcl]) - [Category Data Structure] - [Category String Processing]