-
Notifications
You must be signed in to change notification settings - Fork 6
The unicode library
The unicode
library in Pipefish wraps around the standard unicode
library in Go. As usual, the function names have been converted from PascalCase to camelCase.
Besides that:
-
The
To
function has been renamedtoCase
, and takes an enum of typeCase
as its first parameter. -
The
In
andIs
andIsOneOf
functions have been amalgamated into single functionisIn
which as its second parameter takes a varargs of pairs specifying lower and upper bounds, e.g.unicode.isIn r, 64::91, 97::123
wil test if the runer
is in the alphabetical part of ASCII. As always, ranges include the smaller value and exclude the larger.
The API of the library therefore consists of the Case
type:
Case = enum UPPER_CASE, LOWER_CASE, TITLE_CASE, MAX_CASE
... and a collection of functions with signatures as follows:
isControl(r rune) -> bool
isDigit(r rune) -> bool
isGraphic(r rune) -> bool
isIn(r rune, bounds ... pair) -> bool
isLetter(r rune) -> bool
isLower(r rune) -> bool
isMark(r rune) -> bool
isNumber(r rune) -> bool
isPrint(r rune) -> bool
isPunct(r rune) -> bool
isSpace(r rune) -> bool
isSymbol(r rune) -> bool
isTitle(r rune) -> bool
isUpper(r rune) -> bool
simpleFold(r rune) -> rune
toCase(c Case, r rune) -> rune
toLower(r rune) -> rune
toTitle(r rune) -> rune
toUpper(r rune) -> rune
🧿 Pipefish is distributed under the MIT license. Please steal my code and ideas.