首页 > 编程语言 >Bash Perl Tcl syntax diff

Bash Perl Tcl syntax diff

时间:2022-08-14 16:33:39浏览次数:93  
标签:string reference tcl syntax Tcl bash variable diff store

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

标签:string,reference,tcl,syntax,Tcl,bash,variable,diff,store
From: https://www.cnblogs.com/movit/p/16585670.html

相关文章