File tree Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -79,9 +79,21 @@ def isASCII(c: Char): Bool = { c.toInt < 128 }
79
79
/// Checks if a given character is an ASCII lower alphabetic character
80
80
def isLower(c: Char): Bool = { c >= 'a' && c <= 'z' }
81
81
82
+ /// Lower-cases the given ASCII character
83
+ def toLower(c: Char): Char =
84
+ if (c >= 'A' && c <= 'Z') {
85
+ ('a'.toInt + (c.toInt - 'A'.toInt)).toChar
86
+ } else { c }
87
+
82
88
/// Checks if a given character is an ASCII upper alphabetic character
83
89
def isUpper(c: Char): Bool = { c >= 'A' && c <= 'Z' }
84
90
91
+ /// Upper-cases the given ASCII character
92
+ def toUpper(c: Char): Char =
93
+ if (c >= 'a' && c <= 'z') {
94
+ ('A'.toInt + (c.toInt - 'a'.toInt)).toChar
95
+ } else { c }
96
+
85
97
/// Checks if a given character is an ASCII alphabetic or numeric character
86
98
def isAlphanumeric(c: Char): Bool = isDigit(c) || isLower(c) || isUpper(c)
87
99
You can’t perform that action at this time.
0 commit comments