]> Cypherpunks repositories - gostls13.git/commit
unicode: add "In" function to test membership of a rune
authorRob Pike <r@golang.org>
Wed, 24 Jul 2013 00:27:58 +0000 (10:27 +1000)
committerRob Pike <r@golang.org>
Wed, 24 Jul 2013 00:27:58 +0000 (10:27 +1000)
commit6a801539c5f4702b1a7e9e7bbb117ddf889145c7
tree39549aebcadca912116e21e29be8026366fa3800
parenta0a45bbb71d6232040d18ee5d8e3d6eebcbfe944
unicode: add "In" function to test membership of a rune
The existing function, IsOneOf, is hard to use. Since the slice comes
before the rune, in parallelism with the other Is functions, the slice
is clumsy to build. This CL adds a nicer-signatured In function of
equivalent functionality (its implementation is identical) that's much
easier to use. Compare:
        unicode.IsOneOf([]*unicode.RangeTable{unicode.Letter, unicode.Number}, r)
        unicode.In(r, unicode.Letter, unicode.Number)

R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/11672044
src/pkg/unicode/graphic.go
src/pkg/unicode/graphic_test.go