return Is(Letter, rune);
}
+// IsSpace reports whether the rune is a white space character.
+func IsSpace(rune int) bool {
+ if rune <= 0xFF { // quick Latin-1 check
+ switch rune {
+ case '\t', '\n', '\v', '\f', '\r', ' ', 0x85, 0xA0:
+ return true;
+ }
+ return false;
+ }
+ return Is(White_Space, rune);
+}
+
// To maps the rune to the specified case: UpperCase, LowerCase, or TitleCase
func To(_case int, rune int) int {
if _case < 0 || MaxCase <= _case {
0x10ffff,
}
+// Contains all the special cased Latin-1 chars.
+var spaceTest = []int{
+ 0x09,
+ 0x0a,
+ 0x0b,
+ 0x0c,
+ 0x0d,
+ 0x20,
+ 0x85,
+ 0xA0,
+ 0x2000,
+ 0x3000,
+}
+
type caseT struct {
cas, in, out int
}
}
}
}
+
+func TestIsSpace(t *testing.T) {
+ for _, c := range spaceTest {
+ if !IsSpace(c) {
+ t.Errorf("IsSpace(U+%04X) = false; want true", c);
+ }
+ }
+ for _, c := range letterTest {
+ if IsSpace(c) {
+ t.Errorf("IsSpace(U+%04X) = true; want false", c);
+ }
+ }
+}