package helpersimportfunc ( rune, , rune) bool {if > {returnfalse }if >= {returntrue }returnfalse}// According to UTS#18 Unicode Regular Expressions (http://www.unicode.org/reports/tr18/)// RL 1.4 Simple Word Boundaries The class of <word_character> includes all Alphabetic// values from the Unicode character database, from UnicodeData.txt [UData], plus the U+200C// ZERO WIDTH NON-JOINER and U+200D ZERO WIDTH JOINER.func ( rune) bool {// matches charclass.go//TODO: add optimization here for ascii//"L", "Mn", "Nd", "Pc"returnunicode.In(,unicode.Categories["L"], unicode.Categories["Mn"],unicode.Categories["Nd"], unicode.Categories["Pc"]) || == '\u200D' || == '\u200C'//return 'A' <= r && r <= 'Z' || 'a' <= r && r <= 'z' || '0' <= r && r <= '9' || r == '_'}func ( rune, uint32) bool {//BDFHJLNPRTVX = 10101010 10101010 10101010 00000000 //B = 00000000 00000000 00000000 01000010 //char=B-B = 00000000 00000000 00000000 00000000 //BDFH.. << 0 = 10101010 10101010 10101010 00000000 //char-32 = 11111111 11111111 11111111 11100000 //& = 10101010 10101010 10101010 00000000 // first bit is 1 then negative, so it matches//charMinusLowUInt32 := int32(ch - low)returnint32((<<uint16())&uint32(-32)) < 0}func ( rune, uint64) bool {//64-bit version of the above //charMinusLowUInt64 := int64(ch - low)returnint64((<<uint32())&uint64(-64)) < 0}func ( rune, uint64, uint64) bool {if < 64 {return &(1<<uint()) != 0 }if < 128 {return &(1<<uint(-64)) != 0 }returnfalse}
The pages are generated with Goldsv0.8.7. (GOOS=linux GOARCH=amd64)
Golds is a Go 101 project developed by Tapir Liu.
PR and bug reports are welcome and can be submitted to the issue list.
Please follow @zigo_101 (reachable from the left QR code) to get the latest news of Golds.