Bash Perl Tcl syntax diff

2022/8/15 1:24:40

本文主要是介绍Bash Perl Tcl syntax diff,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!

Bash Perl Tcl syntax diff

1. 进制数表示

Language binary octal hexadecimal
bash 2#[0~1] 0[0~7] 0x[0~f] or 0X[0~f]
perl 0b[0~1] 0[0~7] 0x[0~f]
tcl 0b[0~1] 0o[0~7] 0x[0~f]

bash different base represntation reference

2. String length

Language String length
bash ${#variable_store_string}
perl length($variable_store_string)
tcl string length variable_store_string

bash string length reference

perl string length reference

https://www.tutorialspoint.com/tcl-tk/tcl_strings.htm

3. String upper/lower

Language String upper String lower
bash ${variable_store_string^^} ${variable_store_string,,}
perl uc($variable_store_string) lc($variable_store_string)
tcl string toupper variable_store_string string tolower variable_store_string
# perl

\u 修改下一个字符为大写
\l 修改下一个字符小写 
\U 修改后面所有字符大写 
\L 修改后面所有字符小写 
\Q 使后面的所有字符都成为字面符号
\E 结束\U \L或\Q的效果

# =============================================================== #
 perl				 bash			       tcl

ucfirst				${var^}			string toupper 0/string totitle
lcfirst				${var,}			string tolower 0
# bash

declare -l var="strings"
declare -u var="strings"

bash upper/lower blog reference

declare command reference

tr command reference



这篇关于Bash Perl Tcl syntax diff的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!


扫一扫关注最新编程教程