如何在TCL中找到大写和小写字母的计数
如何在TCL中找到大写AMD较低情况的计数 使用此代码,我只获得ASCII值
foreach character {H e l l o T C L} {
scan $character %c numeric
puts "ASCII character '$numeric' displays as '$character'."
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以使用
REGEXP
来为您提供计数:我使用
[:upper:]]
和[[:::较低:]]
而不是[az]
和[az]
,因为前者将正确捕获Unicode上下语,而不仅仅是仅仅捕获Unicode的上下文ASCII集。Instead of looping through a string yourself, you can use
regexp
to give you a count:I'm using
[[:upper:]]
and[[:lower:]]
instead of[A-Z]
and[a-z]
because the former will correctly capture unicode upper- and lowercase, rather than just the ones in the ASCII set.您可以使用
字符串为$ targe
和字符串为较低$ tarnic
来测试每个字符。请注意,非字母字符既不是上层或下情况。有关更多信息,请访问 httpps:// wwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww ofYou can test each character with
string is upper $character
andstring is lower $character
. Note that non-alphabetic characters are neither upper or lower case. For more info check the documentation at https://www.tcl-lang.org/man/tcl8.6/TclCmd/string.htm#M10