mirror of
git://git.code.sf.net/p/zsh/code
synced 2025-10-14 11:41:07 +02:00
34657: document the effect of substring subscripting better
This commit is contained in:
parent
ec03a233c5
commit
00b3085b96
2 changed files with 16 additions and 1 deletions
|
@ -1,3 +1,8 @@
|
||||||
|
2015-03-06 Peter Stephenson <p.stephenson@samsung.com>
|
||||||
|
|
||||||
|
* 34657: Doc/Zsh/params.yo: document the effect of substring
|
||||||
|
subscripting better.
|
||||||
|
|
||||||
2015-03-05 Peter Stephenson <p.stephenson@samsung.com>
|
2015-03-05 Peter Stephenson <p.stephenson@samsung.com>
|
||||||
|
|
||||||
* 34654: Completion/Redhat/Command/_rpm: complete absolute file
|
* 34654: Completion/Redhat/Command/_rpm: complete absolute file
|
||||||
|
|
|
@ -187,7 +187,17 @@ from the end of the array tt(foo), and
|
||||||
Subscripting may also be performed on non-array values, in which
|
Subscripting may also be performed on non-array values, in which
|
||||||
case the subscripts specify a substring to be extracted.
|
case the subscripts specify a substring to be extracted.
|
||||||
For example, if tt(FOO) is set to `tt(foobar)', then
|
For example, if tt(FOO) is set to `tt(foobar)', then
|
||||||
`tt(echo $FOO[2,5])' prints `tt(ooba)'.
|
`tt(echo $FOO[2,5])' prints `tt(ooba)'. Note that
|
||||||
|
some forms of subscripting described below perform pattern matching,
|
||||||
|
and in that case the substring extends from the start of the match
|
||||||
|
of the first subscript to the end of the match of the second
|
||||||
|
subscript. For example,
|
||||||
|
|
||||||
|
example(string="abcdefghijklm"
|
||||||
|
print ${string[+LPAR()r+RPAR()d?,+LPAR()r+RPAR()h?]})
|
||||||
|
|
||||||
|
prints `tt(defghi)'. This is an obvious generalisation of the
|
||||||
|
rule for single-character matches.
|
||||||
|
|
||||||
subsect(Array Element Assignment)
|
subsect(Array Element Assignment)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue