Mercurial > projects > dwt2
annotate base/src/java/lang/Character.d @ 88:9e0ab372d5d8
Revert from TypeInfo/ClassInfo to java.lang.Class
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Sun, 19 Apr 2009 11:10:09 +0200 |
parents | fcf926c91ca4 |
children | 5d5bd660917f |
rev | line source |
---|---|
2
712ffca654f3
Moved java classes to their correct location
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
1 module java.lang.Character; |
712ffca654f3
Moved java classes to their correct location
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
2 |
712ffca654f3
Moved java classes to their correct location
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
3 import java.lang.exceptions; |
712ffca654f3
Moved java classes to their correct location
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
4 import java.lang.util; |
88
9e0ab372d5d8
Revert from TypeInfo/ClassInfo to java.lang.Class
Frank Benoit <benoit@tionex.de>
parents:
84
diff
changeset
|
5 import java.lang.Class; |
21
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
9
diff
changeset
|
6 |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
9
diff
changeset
|
7 version(Tango){ |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
9
diff
changeset
|
8 static import tango.text.Unicode; |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
9
diff
changeset
|
9 } else { // Phobos |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
9
diff
changeset
|
10 static import std.utf; |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
9
diff
changeset
|
11 static import std.uni; |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
9
diff
changeset
|
12 static import std.ctype; |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
9
diff
changeset
|
13 static import std.string; |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
9
diff
changeset
|
14 } |
2
712ffca654f3
Moved java classes to their correct location
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
15 |
712ffca654f3
Moved java classes to their correct location
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
16 class Character { |
712ffca654f3
Moved java classes to their correct location
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
17 public static bool isUpperCase( dchar c ){ |
712ffca654f3
Moved java classes to their correct location
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
18 implMissing( __FILE__, __LINE__); |
712ffca654f3
Moved java classes to their correct location
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
19 return false; |
712ffca654f3
Moved java classes to their correct location
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
20 } |
9 | 21 public static dchar toUpperCase( wchar c ){ |
21
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
9
diff
changeset
|
22 version(Tango){ |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
9
diff
changeset
|
23 wchar[1] src; |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
9
diff
changeset
|
24 src[0] = c; |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
9
diff
changeset
|
25 dchar[1] buf; |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
9
diff
changeset
|
26 uint ate; |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
9
diff
changeset
|
27 dchar[] darr = tango.text.convert.Utf.toString32( src, buf, &ate ); |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
9
diff
changeset
|
28 } else { // Phobos |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
9
diff
changeset
|
29 wchar[1] src; |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
9
diff
changeset
|
30 src[0] = c; |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
9
diff
changeset
|
31 auto darr = std.utf.toUTF32(src); |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
9
diff
changeset
|
32 } |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
9
diff
changeset
|
33 return toUpperCase( darr[0] ); |
9 | 34 } |
2
712ffca654f3
Moved java classes to their correct location
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
35 public static dchar toUpperCase( dchar c ){ |
21
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
9
diff
changeset
|
36 version(Tango){ |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
9
diff
changeset
|
37 dchar[1] src; |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
9
diff
changeset
|
38 src[0] = c; |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
9
diff
changeset
|
39 dchar[] r = tango.text.Unicode.toUpper( src ); |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
9
diff
changeset
|
40 return r[0]; |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
9
diff
changeset
|
41 } else { // Phobos |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
9
diff
changeset
|
42 return std.uni.toUniUpper( c ); |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
9
diff
changeset
|
43 } |
2
712ffca654f3
Moved java classes to their correct location
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
44 } |
9 | 45 public static dchar toLowerCase( wchar c ){ |
21
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
9
diff
changeset
|
46 version(Tango){ |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
9
diff
changeset
|
47 wchar[1] src; |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
9
diff
changeset
|
48 src[0] = c; |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
9
diff
changeset
|
49 dchar[1] buf; |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
9
diff
changeset
|
50 uint ate; |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
9
diff
changeset
|
51 dchar[] darr = tango.text.convert.Utf.toString32( src, buf, &ate ); |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
9
diff
changeset
|
52 } else { // Phobos |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
9
diff
changeset
|
53 wchar[1] src; |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
9
diff
changeset
|
54 src[0] = c; |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
9
diff
changeset
|
55 auto darr = std.utf.toUTF32(src); |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
9
diff
changeset
|
56 } |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
9
diff
changeset
|
57 return toLowerCase( darr[0] ); |
9 | 58 } |
2
712ffca654f3
Moved java classes to their correct location
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
59 public static dchar toLowerCase( dchar c ){ |
21
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
9
diff
changeset
|
60 version(Tango){ |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
9
diff
changeset
|
61 dchar[1] src; |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
9
diff
changeset
|
62 src[0] = c; |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
9
diff
changeset
|
63 dchar[] r = tango.text.Unicode.toLower( src ); |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
9
diff
changeset
|
64 return r[0]; |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
9
diff
changeset
|
65 } else { // Phobos |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
9
diff
changeset
|
66 return std.uni.toUniLower( c ); |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
9
diff
changeset
|
67 } |
2
712ffca654f3
Moved java classes to their correct location
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
68 } |
712ffca654f3
Moved java classes to their correct location
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
69 public static bool isWhitespace( dchar c ){ |
21
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
9
diff
changeset
|
70 version(Tango){ |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
9
diff
changeset
|
71 return tango.text.Unicode.isWhitespace( c ); |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
9
diff
changeset
|
72 } else { // Phobos |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
9
diff
changeset
|
73 return std.string.iswhite(c); |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
9
diff
changeset
|
74 } |
2
712ffca654f3
Moved java classes to their correct location
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
75 } |
712ffca654f3
Moved java classes to their correct location
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
76 public static bool isDigit( dchar c ){ |
21
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
9
diff
changeset
|
77 version(Tango){ |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
9
diff
changeset
|
78 return tango.text.Unicode.isDigit( c ); |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
9
diff
changeset
|
79 } else { // Phobos |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
9
diff
changeset
|
80 return cast(bool)std.ctype.isdigit(c); |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
9
diff
changeset
|
81 } |
2
712ffca654f3
Moved java classes to their correct location
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
82 } |
9 | 83 public static bool isLetter( dchar c ){ |
21
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
9
diff
changeset
|
84 version(Tango){ |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
9
diff
changeset
|
85 return tango.text.Unicode.isLetter(c); |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
9
diff
changeset
|
86 } else { // Phobos |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
9
diff
changeset
|
87 return cast(bool)std.ctype.isalpha(c); |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
9
diff
changeset
|
88 } |
9 | 89 } |
90 public static bool isSpace( dchar c ){ | |
21
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
9
diff
changeset
|
91 version(Tango){ |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
9
diff
changeset
|
92 return tango.text.Unicode.isSpace(c); |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
9
diff
changeset
|
93 } else { // Phobos |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
9
diff
changeset
|
94 return cast(bool)std.ctype.isspace(c); |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
9
diff
changeset
|
95 } |
9 | 96 } |
97 public static bool isWhiteSpace( dchar c ){ | |
21
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
9
diff
changeset
|
98 version(Tango){ |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
9
diff
changeset
|
99 return tango.text.Unicode.isWhitespace(c); |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
9
diff
changeset
|
100 } else { // Phobos |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
9
diff
changeset
|
101 return std.string.iswhite(c); |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
9
diff
changeset
|
102 } |
9 | 103 } |
2
712ffca654f3
Moved java classes to their correct location
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
104 public static bool isLetterOrDigit( dchar c ){ |
712ffca654f3
Moved java classes to their correct location
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
105 return isDigit(c) || isLetter(c); |
712ffca654f3
Moved java classes to their correct location
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
106 } |
712ffca654f3
Moved java classes to their correct location
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
107 public static bool isUnicodeIdentifierPart(char ch){ |
712ffca654f3
Moved java classes to their correct location
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
108 implMissing( __FILE__, __LINE__); |
712ffca654f3
Moved java classes to their correct location
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
109 return false; |
712ffca654f3
Moved java classes to their correct location
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
110 } |
712ffca654f3
Moved java classes to their correct location
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
111 public static bool isUnicodeIdentifierStart(char ch){ |
712ffca654f3
Moved java classes to their correct location
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
112 implMissing( __FILE__, __LINE__); |
712ffca654f3
Moved java classes to their correct location
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
113 return false; |
712ffca654f3
Moved java classes to their correct location
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
114 } |
712ffca654f3
Moved java classes to their correct location
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
115 public static bool isIdentifierIgnorable(char ch){ |
712ffca654f3
Moved java classes to their correct location
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
116 implMissing( __FILE__, __LINE__); |
712ffca654f3
Moved java classes to their correct location
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
117 return false; |
712ffca654f3
Moved java classes to their correct location
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
118 } |
712ffca654f3
Moved java classes to their correct location
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
119 public static bool isJavaIdentifierPart(char ch){ |
712ffca654f3
Moved java classes to their correct location
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
120 implMissing( __FILE__, __LINE__); |
712ffca654f3
Moved java classes to their correct location
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
121 return false; |
712ffca654f3
Moved java classes to their correct location
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
122 } |
712ffca654f3
Moved java classes to their correct location
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
123 |
712ffca654f3
Moved java classes to their correct location
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
124 this( char c ){ |
712ffca654f3
Moved java classes to their correct location
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
125 // must be correct for container storage |
712ffca654f3
Moved java classes to their correct location
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
126 implMissing( __FILE__, __LINE__); |
712ffca654f3
Moved java classes to their correct location
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
127 } |
84 | 128 |
88
9e0ab372d5d8
Revert from TypeInfo/ClassInfo to java.lang.Class
Frank Benoit <benoit@tionex.de>
parents:
84
diff
changeset
|
129 private static Class TYPE_; |
9e0ab372d5d8
Revert from TypeInfo/ClassInfo to java.lang.Class
Frank Benoit <benoit@tionex.de>
parents:
84
diff
changeset
|
130 public static Class TYPE(){ |
84 | 131 if( TYPE_ is null ){ |
88
9e0ab372d5d8
Revert from TypeInfo/ClassInfo to java.lang.Class
Frank Benoit <benoit@tionex.de>
parents:
84
diff
changeset
|
132 TYPE_ = Class.fromType!(char); |
84 | 133 } |
134 return TYPE_; | |
135 } | |
136 | |
137 public dchar charValue(){ | |
138 implMissing( __FILE__, __LINE__); | |
139 return ' '; | |
140 } | |
2
712ffca654f3
Moved java classes to their correct location
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
141 } |
21
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
9
diff
changeset
|
142 |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
9
diff
changeset
|
143 bool CharacterIsDefined( dchar ch ){ |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
9
diff
changeset
|
144 version(Tango){ |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
9
diff
changeset
|
145 return (ch in tango.text.UnicodeData.unicodeData) !is null; |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
9
diff
changeset
|
146 } else { // Phobos |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
9
diff
changeset
|
147 implMissing( __FILE__, __LINE__); |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
9
diff
changeset
|
148 return false; |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
9
diff
changeset
|
149 } |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
9
diff
changeset
|
150 } |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
9
diff
changeset
|
151 |
51 | 152 dchar CharacterFirstToLower( CString str ){ |
21
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
9
diff
changeset
|
153 int consumed; |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
9
diff
changeset
|
154 return CharacterFirstToLower( str, consumed ); |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
9
diff
changeset
|
155 } |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
9
diff
changeset
|
156 |
51 | 157 dchar CharacterFirstToLower( CString str, out int consumed ){ |
21
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
9
diff
changeset
|
158 version(Tango){ |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
9
diff
changeset
|
159 dchar[1] buf; |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
9
diff
changeset
|
160 buf[0] = firstCodePoint( str, consumed ); |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
9
diff
changeset
|
161 dchar[] r = tango.text.Unicode.toLower( buf ); |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
9
diff
changeset
|
162 return r[0]; |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
9
diff
changeset
|
163 } else { // Phobos |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
9
diff
changeset
|
164 implMissing( __FILE__, __LINE__); |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
9
diff
changeset
|
165 return 0; |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
9
diff
changeset
|
166 } |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
9
diff
changeset
|
167 } |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
9
diff
changeset
|
168 |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
9
diff
changeset
|
169 dchar CharacterToLower( dchar c ){ |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
9
diff
changeset
|
170 version(Tango){ |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
9
diff
changeset
|
171 dchar[] r = tango.text.Unicode.toLower( [c] ); |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
9
diff
changeset
|
172 return r[0]; |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
9
diff
changeset
|
173 } else { // Phobos |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
9
diff
changeset
|
174 implMissing( __FILE__, __LINE__); |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
9
diff
changeset
|
175 return 0; |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
9
diff
changeset
|
176 } |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
9
diff
changeset
|
177 } |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
9
diff
changeset
|
178 dchar CharacterToUpper( dchar c ){ |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
9
diff
changeset
|
179 version(Tango){ |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
9
diff
changeset
|
180 dchar[] r = tango.text.Unicode.toUpper( [c] ); |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
9
diff
changeset
|
181 return r[0]; |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
9
diff
changeset
|
182 } else { // Phobos |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
9
diff
changeset
|
183 implMissing( __FILE__, __LINE__); |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
9
diff
changeset
|
184 return 0; |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
9
diff
changeset
|
185 } |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
9
diff
changeset
|
186 } |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
9
diff
changeset
|
187 bool CharacterIsWhitespace( dchar c ){ |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
9
diff
changeset
|
188 version(Tango){ |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
9
diff
changeset
|
189 return tango.text.Unicode.isWhitespace( c ); |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
9
diff
changeset
|
190 } else { // Phobos |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
9
diff
changeset
|
191 implMissing( __FILE__, __LINE__); |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
9
diff
changeset
|
192 return false; |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
9
diff
changeset
|
193 } |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
9
diff
changeset
|
194 } |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
9
diff
changeset
|
195 bool CharacterIsDigit( dchar c ){ |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
9
diff
changeset
|
196 version(Tango){ |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
9
diff
changeset
|
197 return tango.text.Unicode.isDigit( c ); |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
9
diff
changeset
|
198 } else { // Phobos |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
9
diff
changeset
|
199 implMissing( __FILE__, __LINE__); |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
9
diff
changeset
|
200 return false; |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
9
diff
changeset
|
201 } |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
9
diff
changeset
|
202 } |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
9
diff
changeset
|
203 bool CharacterIsLetter( dchar c ){ |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
9
diff
changeset
|
204 version(Tango){ |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
9
diff
changeset
|
205 return tango.text.Unicode.isLetter( c ); |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
9
diff
changeset
|
206 } else { // Phobos |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
9
diff
changeset
|
207 implMissing( __FILE__, __LINE__); |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
9
diff
changeset
|
208 return false; |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
9
diff
changeset
|
209 } |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
9
diff
changeset
|
210 } |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
9
diff
changeset
|
211 |
84 | 212 |