Descriptionunicode: added In and NotIn methods to RangeTables. This allows RangeTables
to directly be passed to Remove, Validate and possibly other funcs in the
go.text/runes (see https://codereview.appspot.com/151580043/) or other
go.text packages.
For example, to get a transformer that removes modifiers, one would now write:
isMn := func(r rune) bool { return unicode.In(r, unicode.Mn) }
rmMn := runes.Remove(isMn)
With this change it could be rewritten as:
rmMn := runes.Remove(unicode.Mn.In)
Note: inlining the body of Is in the new In methods seems to increase
performance by about 15%. I havent done so for clarity, but it was one
factor in the decision of adding these methods (versus adding helper funcs
in the runes package, for example) as it will allow for a performance
optimization that otherwise doesn't seem possible.
Patch Set 1 #Patch Set 2 : diff -r c54b847a8ea3 https://code.google.com/p/go #Patch Set 3 : diff -r c54b847a8ea3 https://code.google.com/p/go #Patch Set 4 : diff -r 0bee9108569f https://code.google.com/p/go #
MessagesTotal messages: 4
|