Sujet : Re: tdom encoding
De : nospam.nurdglaw (at) *nospam* gmail.com (Alan Grunwald)
Groupes : comp.lang.tclDate : 19. Dec 2024, 17:36:20
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <vk1i4j$2ug1o$1@dont-email.me>
References : 1 2
User-Agent : Mozilla Thunderbird
On 17/12/2024 02:13, greg wrote:
<snip>
proc chr c {
if {[string length $c] > 1 } {
error "chr: arg should be a single char"
}
set v 0
scan $c %c v
return $v
}
# Check character types and provide additional information
proc charInfo char {
if {[string is control $char]} {
return "control character"
} elseif {[string is space $char]} {
return "space character"
} elseif {[string is digit $char]} {
return "digit character"
} elseif {[string is lower $char]} {
return "lowercase alphabetic character"
} elseif {[string is upper $char]} {
return "uppercase alphabetic character"
} elseif {[string is punct $char]} {
return "punctuation character"
} elseif {[string is graph $char]} {
return "graphical character"
} elseif {[string is print $char]} {
return "printable character"
} else {
return "unknown character type"
}
}<snip>
Many thanks from me too for the above procs, which have made their way (with acknowledgement) into my personal library of utility routines.
Alan