-
Notifications
You must be signed in to change notification settings - Fork 5
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
Tofunction has been renamedtoCase, and takes an enum of typeCaseas its first parameter. -
The
InandIsandIsOneOffunctions have been amalgamated into single functionisInwhich as its second parameter takes a varargs of pairs specifying lower and upper bounds, e.g.unicode.isIn r, 64::91, 97::123wil test if the runeris 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) -> boolisDigit(r rune) -> boolisGraphic(r rune) -> boolisIn(r rune, bounds ... pair) -> boolisLetter(r rune) -> boolisLower(r rune) -> boolisMark(r rune) -> boolisNumber(r rune) -> boolisPrint(r rune) -> boolisPunct(r rune) -> boolisSpace(r rune) -> boolisSymbol(r rune) -> boolisTitle(r rune) -> boolisUpper(r rune) -> boolsimpleFold(r rune) -> runetoCase(c Case, r rune) -> runetoLower(r rune) -> runetoTitle(r rune) -> runetoUpper(r rune) -> rune
🧿 Pipefish is distributed under the MIT license. Please steal my code and ideas.