litesoft
Diff Revisions
625
vs
626
for /trunk/GWT_Sandbox/FormEngine/src/com/temp/shared/utils/CharacterUtils.java
|
@@ -1,29 +1,46 @@ |
1 |
|
- |
package com.temp.shared.utils; |
2 |
|
- |
|
3 |
|
- |
public class CharacterUtils |
4 |
|
- |
{ |
5 |
|
- |
public static boolean isAlphaNumericUnderScore7bitAscii( char c ) |
6 |
|
- |
{ |
7 |
|
- |
return isNumeric( c ) || is7bitAlphaUnderScore( c ); |
8 |
|
- |
} |
9 |
|
- |
|
10 |
|
- |
public static boolean is7bitAlphaUnderScore( char c ) |
11 |
|
- |
{ |
12 |
|
- |
return (c == '_') || is7bitAlpha( c ); |
13 |
|
- |
} |
14 |
|
- |
|
15 |
|
- |
public static boolean is7bitAlphaNumeric( char c ) |
16 |
|
- |
{ |
17 |
|
- |
return isNumeric( c ) || is7bitAlpha( c ); |
18 |
|
- |
} |
19 |
|
- |
|
20 |
|
- |
public static boolean is7bitAlpha( char c ) |
21 |
|
- |
{ |
22 |
|
- |
return ((('A' <= c) && (c <= 'Z')) || (('a' <= c) && (c <= 'z'))); |
23 |
|
- |
} |
24 |
|
- |
|
25 |
|
- |
public static boolean isNumeric( char c ) |
26 |
|
- |
{ |
27 |
|
- |
return (('0' <= c) && (c <= '9')); |
28 |
|
- |
} |
29 |
|
- |
} |
|
1 |
+ |
package com.temp.shared.utils; |
|
2 |
+ |
|
|
3 |
+ |
public class CharacterUtils { |
|
4 |
+ |
public static final int NEWLINE = 10; |
|
5 |
+ |
public static final int DEL = 127; |
|
6 |
+ |
public static final int HIBIT_SPACE = 160; |
|
7 |
+ |
|
|
8 |
+ |
private static final String UNACCEPTABLE_NON_CONTROL_FILENAME_CHARACTERS = "|\\?*<\":>+[]/"; |
|
9 |
+ |
|
|
10 |
+ |
public static boolean isUnacceptableNonControlFilenameChar(char c) { |
|
11 |
+ |
return (UNACCEPTABLE_NON_CONTROL_FILENAME_CHARACTERS.indexOf(c) != -1); |
|
12 |
+ |
} |
|
13 |
+ |
|
|
14 |
+ |
public static boolean isControlChar(char c) { |
|
15 |
+ |
return (c < ' ') || ((DEL <= c) && (c < HIBIT_SPACE)); |
|
16 |
+ |
} |
|
17 |
+ |
|
|
18 |
+ |
public static boolean isDisplayable7BitAsciiAllowingSpaceAndNewline(char c) { |
|
19 |
+ |
return (c == NEWLINE) || ((' ' <= c) && (c <= DEL)); |
|
20 |
+ |
} |
|
21 |
+ |
|
|
22 |
+ |
public static boolean isAlphaNumericUnderScore7BitAscii( char c ) |
|
23 |
+ |
{ |
|
24 |
+ |
return isNumeric( c ) || is7BitAlphaUnderScore( c ); |
|
25 |
+ |
} |
|
26 |
+ |
|
|
27 |
+ |
public static boolean is7BitAlphaUnderScore( char c ) |
|
28 |
+ |
{ |
|
29 |
+ |
return (c == '_') || is7BitAlpha( c ); |
|
30 |
+ |
} |
|
31 |
+ |
|
|
32 |
+ |
public static boolean is7BitAlphaNumeric( char c ) |
|
33 |
+ |
{ |
|
34 |
+ |
return isNumeric( c ) || is7BitAlpha( c ); |
|
35 |
+ |
} |
|
36 |
+ |
|
|
37 |
+ |
public static boolean is7BitAlpha( char c ) |
|
38 |
+ |
{ |
|
39 |
+ |
return ((('A' <= c) && (c <= 'Z')) || (('a' <= c) && (c <= 'z'))); |
|
40 |
+ |
} |
|
41 |
+ |
|
|
42 |
+ |
public static boolean isNumeric( char c ) |
|
43 |
+ |
{ |
|
44 |
+ |
return (('0' <= c) && (c <= '9')); |
|
45 |
+ |
} |
|
46 |
+ |
} |