1
0
Fork 0

add eXtended isstring: isxstring(), which also applies to \n

This commit is contained in:
mfranz 2009-01-27 19:27:21 +00:00
parent fedd64d89a
commit 9957c0a6e1

View file

@ -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)