bash中字符串的处理
1.得到字符串长度 方法一: $echo ${#variable} code: PHP 代码:
zhyfly: ~$ x="this is a test" $expr length "$variable" code: PHP 代码:
zhyfly: ~$ x="this is a test" $expr "$variable" : ".*" code: PHP 代码:
zhyfly: ~$ x="this is a test" 方法: $expr index "$variable" "substring" code: PHP 代码:
zhyfly: ~$ x="this is a test" 3.得到字符串子字符串 方法一: $echo ${variable:position:length} code: PHP 代码:
zhyfly: ~$ x="this is a test" 更多相关文章
|
推荐文章
精彩文章
|