add eXtended isstring: isxstring(), which also applies to \n
This commit is contained in:
parent
fedd64d89a
commit
9957c0a6e1
1 changed files with 5 additions and 3 deletions
|
@ -17,6 +17,8 @@ var isprint = func(c) isgraph(c) or c == ` `;
|
|||
var toupper = func(c) islower(c) ? c + `A` - `a` : c;
|
||||
var tolower = func(c) isupper(c) ? c + `a` - `A` : c;
|
||||
|
||||
var isxspace = func(c) isspace(c) or c == `\n`;
|
||||
|
||||
|
||||
##
|
||||
# trim spaces at the left (lr < 0), at the right (lr > 0), or both (lr = 0)
|
||||
|
@ -24,7 +26,7 @@ var tolower = func(c) isupper(c) ? c + `a` - `A` : c;
|
|||
#
|
||||
# string.trim(a); # trim spaces
|
||||
# string.trim(a, 1, string.isdigit); # trim digits at the right
|
||||
# string.trim(a, 0, func(c) string.isspace(c) or c == `\n`); # trim spaces & \n
|
||||
# string.trim(a, 0, func(c) c == `\\` or c == `/`); # trim slashes/backslashes
|
||||
#
|
||||
var trim = func(s, lr = 0, istrim = nil) {
|
||||
if (istrim == nil)
|
||||
|
|
Loading…
Add table
Reference in a new issue