summaryrefslogtreecommitdiff
path: root/src/pkg/unicode/decimaldigit.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/pkg/unicode/decimaldigit.go')
-rw-r--r--src/pkg/unicode/decimaldigit.go52
1 files changed, 52 insertions, 0 deletions
diff --git a/src/pkg/unicode/decimaldigit.go b/src/pkg/unicode/decimaldigit.go
new file mode 100644
index 000000000..1165e3ae1
--- /dev/null
+++ b/src/pkg/unicode/decimaldigit.go
@@ -0,0 +1,52 @@
+// Copyright 2009 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package unicode
+
+// TODO: Generated by hand starting with
+// http://www.unicode.org/Public/UNIDATA/UnicodeData.txt
+// These ranges are the characters with the third field "Nd".
+// Should generate automatically etc.
+
+import "unicode"
+
+// Decimal digit is the set of Unicode characters with the "decimal digit" property.
+var DecimalDigit = []Range{
+ Range{0x0030, 0x0039, 1},
+ Range{0x0660, 0x0669, 1},
+ Range{0x06F0, 0x06F9, 1},
+ Range{0x07C0, 0x07C9, 1},
+ Range{0x0966, 0x096F, 1},
+ Range{0x09E6, 0x09EF, 1},
+ Range{0x0A66, 0x0A6F, 1},
+ Range{0x0AE6, 0x0AEF, 1},
+ Range{0x0B66, 0x0B6F, 1},
+ Range{0x0BE6, 0x0BEF, 1},
+ Range{0x0C66, 0x0C6F, 1},
+ Range{0x0CE6, 0x0CEF, 1},
+ Range{0x0D66, 0x0D6F, 1},
+ Range{0x0E50, 0x0E59, 1},
+ Range{0x0ED0, 0x0ED9, 1},
+ Range{0x0F20, 0x0F29, 1},
+ Range{0x1040, 0x1049, 1},
+ Range{0x1090, 0x1099, 1},
+ Range{0x17E0, 0x17E9, 1},
+ Range{0x1810, 0x1819, 1},
+ Range{0x1946, 0x194F, 1},
+ Range{0x19D0, 0x19D9, 1},
+ Range{0x1B50, 0x1B59, 1},
+ Range{0x1BB0, 0x1BB9, 1},
+ Range{0x1C40, 0x1C49, 1},
+ Range{0x1C50, 0x1C59, 1},
+ Range{0xA620, 0xA629, 1},
+ Range{0xA8D0, 0xA8D9, 1},
+ Range{0xA900, 0xA909, 1},
+ Range{0xAA50, 0xAA59, 1},
+ Range{0xFF10, 0xFF19, 1},
+}
+
+// IsDecimalDigit reports whether the rune is a decimal digit.
+func IsDecimalDigit(rune int) bool {
+ return Is(DecimalDigit, rune);
+}