1
0
mirror of https://github.com/Snailclimb/JavaGuide synced 2025-06-20 22:17:09 +08:00

add string expression explanation

添加了一些表达式说明以及对齐注释
This commit is contained in:
2021-06-13 20:14:14 +08:00 committed by GitHub
parent cd6d4ee78c
commit 96048c4fd0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -235,12 +235,16 @@ echo ${str:0:10} #输出:SnailClimb
#author:amau
var="https://www.runoob.com/linux/linux-shell-variable.html"
s1=${var%%t*}#h
s2=${var%t*}#https://www.runoob.com/linux/linux-shell-variable.h
s3=${var%%.*}#http://www
s4=${var#*/}#/www.runoob.com/linux/linux-shell-variable.html
s5=${var##*/}#linux-shell-variable.html
# %表示删除从后匹配, 最短结果
# %%表示删除从后匹配, 最长匹配结果
# #表示删除从头匹配, 最短结果
# ##表示删除从头匹配, 最长匹配结果
# 注: *为通配符, 意为匹配任意数量的任意字符
s1=${var%%t*} #h
s2=${var%t*} #https://www.runoob.com/linux/linux-shell-variable.h
s3=${var%%.*} #http://www
s4=${var#*/} #/www.runoob.com/linux/linux-shell-variable.html
s5=${var##*/} #linux-shell-variable.html
```
### Shell 数组