Source File
	properties.go
Belonging Package
	github.com/rivo/uniseg
package uniseg// The Unicode properties as used in the various parsers. Only the ones needed// in the context of this package are included.const (prXX = 0 // Same as prAny.prAny = iota // prAny must be 0.prPrepend // Grapheme properties must come first, to reduce the number of bits stored in the state vector.prCRprLFprControlprExtendprRegionalIndicatorprSpacingMarkprLprVprTprLVprLVTprZWJprExtendedPictographicprNewlineprWSegSpaceprDoubleQuoteprSingleQuoteprMidNumLetprNumericprMidLetterprMidNumprExtendNumLetprALetterprFormatprHebrewLetterprKatakanaprSpprSTermprCloseprSContinueprATermprUpperprLowerprSepprOLetterprCMprBAprBKprSPprEXprQUprALprPRprPOprOPprCPprISprHYprSYprNUprCLprNLprGLprAIprBBprHLprSAprJLprJVprJTprNSprZWprB2prINprWJprIDprEBprCJprH2prH3prSGprCBprRIprEMprNprNaprAprWprHprFprEmojiPresentation)// Unicode General Categories. Only the ones needed in the context of this// package are included.const (gcNone = iota // gcNone must be 0.gcCcgcZsgcPogcScgcPsgcPegcSmgcPdgcNdgcLugcSkgcPcgcLlgcSogcLogcPigcCfgcNogcPfgcLCgcLmgcMngcMegcMcgcNlgcZlgcZpgcCngcCsgcCo)// Special code points.const (vs15 = 0xfe0e // Variation Selector-15 (text presentation)vs16 = 0xfe0f // Variation Selector-16 (emoji presentation))// propertySearch performs a binary search on a property slice and returns the// entry whose range (start = first array element, end = second array element)// includes r, or an array of 0's if no such entry was found.func propertySearch[ interface{ [3]int | [4]int }]( [], rune) ( ) {// Run a binary search.:= 0:= len()for > {:= ( + ) / 2:= []if int() < [0] {=continue}if int() > [1] {= + 1continue}return}return}// property returns the Unicode property value (see constants above) of the// given code point.func property( [][3]int, rune) int {return propertySearch(, )[2]}// propertyWithGenCat returns the Unicode property value and General Category// (see constants above) of the given code point.func propertyWithGenCat( [][4]int, rune) (, int) {:= propertySearch(, )return [2], [3]}
![]()  | 
The pages are generated with Golds v0.6.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 @Go100and1 (reachable from the left QR code) to get the latest news of Golds. |