diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2019-01-08 14:22:32 -0200 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2019-01-08 14:22:32 -0200 |
commit | 264659bd53e92969a1e17d65c0266597cde24b5d (patch) | |
tree | 6aba62d2b6ac2a46dc064ea7193c8134200a7d57 /testes/strings.lua | |
parent | 4ace93ca6502dd1da38d5c06fa099d229e791ba8 (diff) | |
download | lua-264659bd53e92969a1e17d65c0266597cde24b5d.tar.gz lua-264659bd53e92969a1e17d65c0266597cde24b5d.tar.bz2 lua-264659bd53e92969a1e17d65c0266597cde24b5d.zip |
Optional 'init' argument to 'string.gmatch'
The function 'string.gmatch' now has an optional 'init' argument,
similar to 'string.find' and 'string.match'. Moreover, there was
some reorganization in the manipulation of indices in the string
library.
This commit also includes small janitorial work in the manual
and in comments in the interpreter loop.
Diffstat (limited to '')
-rw-r--r-- | testes/strings.lua | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/testes/strings.lua b/testes/strings.lua index 587a0e06..88480924 100644 --- a/testes/strings.lua +++ b/testes/strings.lua | |||
@@ -94,6 +94,11 @@ assert(string.char(string.byte("\xe4l\0ķu", 1, -1)) == "\xe4l\0ķu") | |||
94 | assert(string.char(string.byte("\xe4l\0ķu", 1, 0)) == "") | 94 | assert(string.char(string.byte("\xe4l\0ķu", 1, 0)) == "") |
95 | assert(string.char(string.byte("\xe4l\0ķu", -10, 100)) == "\xe4l\0ķu") | 95 | assert(string.char(string.byte("\xe4l\0ķu", -10, 100)) == "\xe4l\0ķu") |
96 | 96 | ||
97 | checkerror("out of range", string.char, 256) | ||
98 | checkerror("out of range", string.char, -1) | ||
99 | checkerror("out of range", string.char, math.maxinteger) | ||
100 | checkerror("out of range", string.char, math.mininteger) | ||
101 | |||
97 | assert(string.upper("ab\0c") == "AB\0C") | 102 | assert(string.upper("ab\0c") == "AB\0C") |
98 | assert(string.lower("\0ABCc%$") == "\0abcc%$") | 103 | assert(string.lower("\0ABCc%$") == "\0abcc%$") |
99 | assert(string.rep('teste', 0) == '') | 104 | assert(string.rep('teste', 0) == '') |