Mercurial > projects > dwt2
annotate base/src/java/lang/Character.d @ 51:c01d033c633a
[swt lin]
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Fri, 27 Mar 2009 19:58:06 +0100 |
parents | 1bf55a6eb092 |
children | fcf926c91ca4 |
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; |
21
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
9
diff
changeset
|
5 |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
9
diff
changeset
|
6 version(Tango){ |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
9
diff
changeset
|
7 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
|
8 } else { // Phobos |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
9
diff
changeset
|
9 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
|
10 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
|
11 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
|
12 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
|
13 } |
2
712ffca654f3
Moved java classes to their correct location
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
14 |
712ffca654f3
Moved java classes to their correct location
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
15 class Character { |
712ffca654f3
Moved java classes to their correct location
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
16 public static bool isUpperCase( dchar c ){ |
712ffca654f3
Moved java classes to their correct location
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
17 implMissing( __FILE__, __LINE__); |
712ffca654f3
Moved java classes to their correct location
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
18 return false; |
712ffca654f3
Moved java classes to their correct location
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
19 } |
9 | 20 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
|
21 version(Tango){ |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
9
diff
changeset
|
22 wchar[1] src; |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
9
diff
changeset
|
23 src[0] = c; |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
9
diff
changeset
|
24 dchar[1] buf; |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
9
diff
changeset
|
25 uint ate; |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
9
diff
changeset
|
26 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
|
27 } else { // Phobos |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
9
diff
changeset
|
28 wchar[1] src; |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
9
diff
changeset
|
29 src[0] = c; |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
9
diff
changeset
|
30 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
|
31 } |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
9
diff
changeset
|
32 return toUpperCase( darr[0] ); |
9 | 33 } |
2
712ffca654f3
Moved java classes to their correct location
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
34 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
|
35 version(Tango){ |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
9
diff
changeset
|
36 dchar[1] src; |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
9
diff
changeset
|
37 src[0] = c; |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
9
diff
changeset
|
38 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
|
39 return r[0]; |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
9
diff
changeset
|
40 } else { // Phobos |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
9
diff
changeset
|
41 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
|
42 } |
2
712ffca654f3
Moved java classes to their correct location
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
43 } |
9 | 44 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
|
45 version(Tango){ |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
9
diff
changeset
|
46 wchar[1] src; |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
9
diff
changeset
|
47 src[0] = c; |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
9
diff
changeset
|
48 dchar[1] buf; |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
9
diff
changeset
|
49 uint ate; |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
9
diff
changeset
|
50 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
|
51 } else { // Phobos |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
9
diff
changeset
|
52 wchar[1] src; |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
9
diff
changeset
|
53 src[0] = c; |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
9
diff
changeset
|
54 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
|
55 } |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
9
diff
changeset
|
56 return toLowerCase( darr[0] ); |
9 | 57 } |
2
712ffca654f3
Moved java classes to their correct location
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
58 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
|
59 version(Tango){ |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
9
diff
changeset
|
60 dchar[1] src; |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
9
diff
changeset
|
61 src[0] = c; |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
9
diff
changeset
|
62 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
|
63 return r[0]; |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
9
diff
changeset
|
64 } else { // Phobos |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
9
diff
changeset
|
65 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
|
66 } |
2
712ffca654f3
Moved java classes to their correct location
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
67 } |
712ffca654f3
Moved java classes to their correct location
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
68 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
|
69 version(Tango){ |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
9
diff
changeset
|
70 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
|
71 } else { // Phobos |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
9
diff
changeset
|
72 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
|
73 } |
2
712ffca654f3
Moved java classes to their correct location
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
74 } |
712ffca654f3
Moved java classes to their correct location
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
75 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
|
76 version(Tango){ |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
9
diff
changeset
|
77 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
|
78 } else { // Phobos |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
9
diff
changeset
|
79 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
|
80 } |
2
712ffca654f3
Moved java classes to their correct location
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
81 } |
9 | 82 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
|
83 version(Tango){ |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
9
diff
changeset
|
84 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
|
85 } else { // Phobos |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
9
diff
changeset
|
86 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
|
87 } |
9 | 88 } |
89 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
|
90 version(Tango){ |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
9
diff
changeset
|
91 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
|
92 } else { // Phobos |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
9
diff
changeset
|
93 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
|
94 } |
9 | 95 } |
96 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
|
97 version(Tango){ |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
9
diff
changeset
|
98 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
|
99 } else { // Phobos |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
9
diff
changeset
|
100 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
|
101 } |
9 | 102 } |
2
712ffca654f3
Moved java classes to their correct location
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
103 public static bool isLetterOrDigit( dchar c ){ |
712ffca654f3
Moved java classes to their correct location
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
104 return isDigit(c) || isLetter(c); |
712ffca654f3
Moved java classes to their correct location
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
105 } |
712ffca654f3
Moved java classes to their correct location
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
106 public static bool isUnicodeIdentifierPart(char ch){ |
712ffca654f3
Moved java classes to their correct location
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
107 implMissing( __FILE__, __LINE__); |
712ffca654f3
Moved java classes to their correct location
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
108 return false; |
712ffca654f3
Moved java classes to their correct location
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
109 } |
712ffca654f3
Moved java classes to their correct location
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
110 public static bool isUnicodeIdentifierStart(char ch){ |
712ffca654f3
Moved java classes to their correct location
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
111 implMissing( __FILE__, __LINE__); |
712ffca654f3
Moved java classes to their correct location
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
112 return false; |
712ffca654f3
Moved java classes to their correct location
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
113 } |
712ffca654f3
Moved java classes to their correct location
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
114 public static bool isIdentifierIgnorable(char ch){ |
712ffca654f3
Moved java classes to their correct location
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
115 implMissing( __FILE__, __LINE__); |
712ffca654f3
Moved java classes to their correct location
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
116 return false; |
712ffca654f3
Moved java classes to their correct location
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
117 } |
712ffca654f3
Moved java classes to their correct location
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
118 public static bool isJavaIdentifierPart(char ch){ |
712ffca654f3
Moved java classes to their correct location
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
119 implMissing( __FILE__, __LINE__); |
712ffca654f3
Moved java classes to their correct location
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
120 return false; |
712ffca654f3
Moved java classes to their correct location
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
121 } |
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 this( char c ){ |
712ffca654f3
Moved java classes to their correct location
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
124 // must be correct for container storage |
712ffca654f3
Moved java classes to their correct location
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
125 implMissing( __FILE__, __LINE__); |
712ffca654f3
Moved java classes to their correct location
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
126 } |
712ffca654f3
Moved java classes to their correct location
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
127 } |
21
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
9
diff
changeset
|
128 |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
9
diff
changeset
|
129 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
|
130 version(Tango){ |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
9
diff
changeset
|
131 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
|
132 } else { // Phobos |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
9
diff
changeset
|
133 implMissing( __FILE__, __LINE__); |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
9
diff
changeset
|
134 return false; |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
9
diff
changeset
|
135 } |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
9
diff
changeset
|
136 } |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
9
diff
changeset
|
137 |
51 | 138 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
|
139 int consumed; |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
9
diff
changeset
|
140 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
|
141 } |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
9
diff
changeset
|
142 |
51 | 143 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
|
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 dchar[1] buf; |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
9
diff
changeset
|
146 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
|
147 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
|
148 return r[0]; |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
9
diff
changeset
|
149 } else { // Phobos |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
9
diff
changeset
|
150 implMissing( __FILE__, __LINE__); |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
9
diff
changeset
|
151 return 0; |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
9
diff
changeset
|
152 } |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
9
diff
changeset
|
153 } |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
9
diff
changeset
|
154 |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
9
diff
changeset
|
155 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
|
156 version(Tango){ |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
9
diff
changeset
|
157 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
|
158 return r[0]; |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
9
diff
changeset
|
159 } else { // Phobos |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
9
diff
changeset
|
160 implMissing( __FILE__, __LINE__); |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
9
diff
changeset
|
161 return 0; |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
9
diff
changeset
|
162 } |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
9
diff
changeset
|
163 } |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
9
diff
changeset
|
164 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
|
165 version(Tango){ |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
9
diff
changeset
|
166 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
|
167 return r[0]; |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
9
diff
changeset
|
168 } else { // Phobos |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
9
diff
changeset
|
169 implMissing( __FILE__, __LINE__); |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
9
diff
changeset
|
170 return 0; |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
9
diff
changeset
|
171 } |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
9
diff
changeset
|
172 } |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
9
diff
changeset
|
173 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
|
174 version(Tango){ |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
9
diff
changeset
|
175 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
|
176 } else { // Phobos |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
9
diff
changeset
|
177 implMissing( __FILE__, __LINE__); |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
9
diff
changeset
|
178 return false; |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
9
diff
changeset
|
179 } |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
9
diff
changeset
|
180 } |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
9
diff
changeset
|
181 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
|
182 version(Tango){ |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
9
diff
changeset
|
183 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
|
184 } else { // Phobos |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
9
diff
changeset
|
185 implMissing( __FILE__, __LINE__); |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
9
diff
changeset
|
186 return false; |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
9
diff
changeset
|
187 } |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
9
diff
changeset
|
188 } |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
9
diff
changeset
|
189 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
|
190 version(Tango){ |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
9
diff
changeset
|
191 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
|
192 } else { // Phobos |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
9
diff
changeset
|
193 implMissing( __FILE__, __LINE__); |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
9
diff
changeset
|
194 return false; |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
9
diff
changeset
|
195 } |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
9
diff
changeset
|
196 } |
9b96950f2c3c
the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents:
9
diff
changeset
|
197 |