com.sun.labs.minion.util
Class CharUtils

java.lang.Object
  extended by com.sun.labs.minion.util.CharUtils

public class CharUtils
extends java.lang.Object

Some char utilities.


Field Summary
protected static char[] toLowerCase
          Return the lower case of a char.
protected static char[] toUpperCase
          Return the upper case of a char.
 
Constructor Summary
CharUtils()
           
 
Method Summary
static boolean caseRoundTrip(char c)
          Converts a character to lower case and then converts the lower case to uppercase.
static java.lang.String decodeUnicode(java.lang.String input)
          Method that traslates unicode escape sequences in an input string into appropriate unicode chars.
static boolean isUncased(java.lang.String s)
          A method to check whether a given string has the same all upper and all lower case forms.
static boolean isUpper(char c)
          Tests whether a given character is upper case.
static void main(java.lang.String[] arg)
          Tests the upper and lowercase
static char toLowerCase(char c)
          Lowercases a single character using our lower case array.
static java.lang.String toLowerCase(java.lang.String s)
          Lower cases a string, using our lower case array.
static char toUpperCase(char c)
          Upper cases a single character, using our upper case array.
static java.lang.String toUpperCase(java.lang.String s)
          Uppercases a string, using our upper case array.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

toLowerCase

protected static final char[] toLowerCase
Return the lower case of a char. Unlike Java's Character.toLowerCase(), this version is free of loops and paths (!).


toUpperCase

protected static final char[] toUpperCase
Return the upper case of a char. Unlike Java's Character.toUpperCase(), this version is free of loops and paths (!).

Constructor Detail

CharUtils

public CharUtils()
Method Detail

toLowerCase

public static java.lang.String toLowerCase(java.lang.String s)
Lower cases a string, using our lower case array.

Parameters:
s - The string that we wish to lowercase.
Returns:
The lowercase version of the string.

toLowerCase

public static char toLowerCase(char c)
Lowercases a single character using our lower case array.

Parameters:
c - The character to lowercase.
Returns:
The lowercase version of the character.

toUpperCase

public static java.lang.String toUpperCase(java.lang.String s)
Uppercases a string, using our upper case array.

Parameters:
s - The string to uppercase.
Returns:
The upper case version of the string.

toUpperCase

public static char toUpperCase(char c)
Upper cases a single character, using our upper case array.

Parameters:
c - The character to upper case.
Returns:
The uppercase character.

isUpper

public static boolean isUpper(char c)
Tests whether a given character is upper case.

Parameters:
c - The character to test.
Returns:
true if the character is upper case, false otherwise

isUncased

public static boolean isUncased(java.lang.String s)
A method to check whether a given string has the same all upper and all lower case forms.

Parameters:
s - The string to test.
Returns:
true if the given string has identical upper and lower case forms.

decodeUnicode

public static final java.lang.String decodeUnicode(java.lang.String input)
Method that traslates unicode escape sequences in an input string into appropriate unicode chars.

Parameters:
input - The input string to be translated.
Returns:
The string with unicode escape sequences replaced with actual unicode characters.

caseRoundTrip

public static boolean caseRoundTrip(char c)
Converts a character to lower case and then converts the lower case to uppercase.

Parameters:
c - The character.
Returns:
true if the character survives the roundtrip, false otherwise.

main

public static void main(java.lang.String[] arg)
                 throws java.lang.Exception
Tests the upper and lowercase

Parameters:
arg - Arguments
Throws:
java.lang.Exception - If anything goes wrong.