Category talk:Wren-str: Difference between revisions

→‎Source code: Multiple bug fixes.
(→‎Source code: Bug fix.)
(→‎Source code: Multiple bug fixes.)
Line 144:
 
// Checks if a string falls into a particular category.
static allAscii(s) { s != "" && s.codePoints.all { |c| c < 128 } }
static allLatin1(s) { s != "" && s.codePoints.all { |c| c < 256 } }
static allDigits(s) { s != "" && s.codePoints.all { |c| c >= 48 && c <= 57 } }
static allAsciiLower(s) { s != "" && s.codePoints.all { |c| c >= 97 && c <= 122 } }
static allAsciiUpper(s) { s != "" && s.codePoints.all { |c| c >= 65 && c <= 90 } }
static allAsciiLetters(s) { s != "" && s.toList.all { |c| Char.isAsciiLetter(c) } }
static allAsciiAlphaNum(s) { s != "" && s.toList.all { |c| Char.isAsciiAlphaNum(c) } }
static allSpace(s) { s != "" && s.toList.all { |c| Char.isSpace(c) } }
static allLower(s) { s != {"" && s.toList.all { |c| Char.isLower(c) } }
static allUpper(s) { s != {"" && s.toList.all { |c| Char.isUpper(c) } }
static allLetters(s) { s != {"" && s.toList.all { |c| Char.isLetter(c) } }
static allAlphaNumeric(s) { s != {"" && s.toList.all { |c| Char.isAlphanumeric(c) } }
static allPrintable(s) { s != {"" && s.toList.all { |c| Char.isPrintable(c) } }
static allGraphic(s) { s != {"" && s.toList.all { |c| Char.isGraphic(c) } }
static allWhitespace(s) { s != {"" && s.toList.all { |c| Char.isWhitespace(c) } }
 
// Checks whether a string can be parsed to a number, an integer or a non-integer (float).
9,476

edits