moka.lang
Class Character

java.lang.Object
  |
  +--moka.lang.Object
        |
        +--moka.lang.Character

public class Character
extends Object

The Character class wraps a value of the primitive type char in an object. An object of type Character contains a single field whose type is char.

In addition, this class provides several methods for determining a character's category (lowercase letter, digit, etc.) and for converting characters from uppercase to lowercase and vice versa. Plus, this class offers several method for ANSI string manipulation.

Character information is based on the ASCII.

Since:
MDK1.0a

Constructor Summary
Character(char value)
          Constructs a newly allocated Character object that represents the primitive char argument.
 
Method Summary
 char charValue()
          Returns the value of this Character object.
static moka.lang.char_p concat(moka.lang.char_p ansiString, moka.lang.char_p anotherAnsiString)
          Concatenates another ANSI string to the end of the specified ANSI string.
static moka.lang.char_p copyValueOf(moka.lang.char_p ansiString)
          Returns a copy of the ANSI string argument.
static moka.lang.char_p copyValueOf(moka.lang.char_p data, int offset, int count)
          Returns the ANSI string representation of a specific subarray of the char array argument.
 boolean equals(moka.lang.Object obj)
          Compares this object against the specified object.
static boolean isDigit(char ch)
          Determines if the specified character is a digit.
static boolean isLetter(char ch)
          Determines if the specified character is a letter.
static boolean isLowerCase(char ch)
          Determines if the specified character is a lowercase character.
static boolean isUpperCase(char ch)
          Determines if the specified character is an uppercase character.
static moka.lang.char_p substring(moka.lang.char_p ansiString, int beginIndex, int endIndex)
          Returns a new ANSI string that is a substring of the specified ANSI string.
static char toLowerCase(char ch)
          Converts the character argument to lowercase using case mapping information from the TI-92 Plus Character Codes chart.
 moka.lang.String toString()
          Returns a String object representing this Character's value.
static char toUpperCase(char ch)
          Converts the character argument to uppercase using case mapping information from the TI-92 Plus Character Codes chart.
static moka.lang.char_p toVat(moka.lang.char_p string)
          Converts an ANSI string into a TIOS VAT String.
static moka.lang.char_p toVat(moka.lang.String string)
          Converts a String object into a TIOS VAT String then finalizes the String.
 
Methods inherited from class moka.lang.Object
finalize, getClassName
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Character

public Character(char value)
Constructs a newly allocated Character object that represents the primitive char argument.

Parameters:
value - the value to be represented by the char.
Method Detail

equals

public boolean equals(moka.lang.Object obj)
Compares this object against the specified object. The result is true if and only if the argument is not null and is a Character object that represents the same char value as this object.

Overrides:
equals in class Object
Parameters:
obj - the object to compare with.
Returns:
true if the objects are the same; false otherwise.

toString

public moka.lang.String toString()
Returns a String object representing this Character's value. The result is a string of length 1 whose sole component is the primitive char value represented by this Character object.

Overrides:
toString in class Object
Returns:
a string representation of this object.

charValue

public char charValue()
Returns the value of this Character object.

Returns:
the primitive char value represented by this object.

concat

public static moka.lang.char_p concat(moka.lang.char_p ansiString,
                                      moka.lang.char_p anotherAnsiString)
Concatenates another ANSI string to the end of the specified ANSI string.

If the length of the argument string is 0, then this ANSI String object is copied then returned. Otherwise, a new ANSI String object is created, representing a character sequence that is the concatenation of the character sequence represented by this ANSI String object and the character sequence represented by the argument string.

Parameters:
ansiString - the ANSI String that will be followed by the other ANSI string.
anotherAnsiString - the ANSI String that is concatenated to the end of the specified ANSI String.
Returns:
an ANSI string that represents the concatenation of the specified ANSI string characters followed by the other ANSI string argument's characters.

copyValueOf

public static moka.lang.char_p copyValueOf(moka.lang.char_p ansiString)
Returns a copy of the ANSI string argument. The contents of the character array are copied; subsequent modification of the character array does not affect the newly created ANSI string.

Returns:
a newly allocated ANSI string representing the same sequence of characters contained in the ANSI string argument.

copyValueOf

public static moka.lang.char_p copyValueOf(moka.lang.char_p data,
                                           int offset,
                                           int count)
Returns the ANSI string representation of a specific subarray of the char array argument.

The offset argument is the index of the first character of the subarray. The count argument specifies the length of the subarray. The contents of the subarray are copied; subsequent modification of the character array does not affect the newly created string.

Parameters:
data - the character array.
offset - the initial offset into the value of the ANSI string.
count - the length of the value of the String.
Returns:
a string representing the sequence of characters contained in the subarray of the character array argument.

toVat

public static moka.lang.char_p toVat(moka.lang.char_p string)
Converts an ANSI string into a TIOS VAT String.

Parameters:
string - The ANSI string
Returns:
The string converted in TIOS VAT string

toVat

public static moka.lang.char_p toVat(moka.lang.String string)
Converts a String object into a TIOS VAT String then finalizes the String.

Parameters:
string - The String object
Returns:
The string converted in TIOS VAT string

isDigit

public static boolean isDigit(char ch)
Determines if the specified character is a digit.

Parameters:
ch - the character to be tested.
Returns:
true if the character is a digit; false otherwise.

isLetter

public static boolean isLetter(char ch)
Determines if the specified character is a letter.

Parameters:
ch - the character to be tested.
Returns:
true if the character is a letter; false otherwise.

isLowerCase

public static boolean isLowerCase(char ch)
Determines if the specified character is a lowercase character.

The following are examples of lowercase characters:

 a b c d e f g h i j k l m n o p q r s t u v w x y z
 

Parameters:
ch - the character to be tested.
Returns:
true if the character is lowercase; false otherwise.

isUpperCase

public static boolean isUpperCase(char ch)
Determines if the specified character is an uppercase character.

The following are examples of uppercase characters:

 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
 

Parameters:
ch - the character to be tested.
Returns:
true if the character is uppercase; false otherwise.

substring

public static moka.lang.char_p substring(moka.lang.char_p ansiString,
                                         int beginIndex,
                                         int endIndex)
Returns a new ANSI string that is a substring of the specified ANSI string. The substring begins at the specified beginIndex and extends to the character at index endIndex - 1. Thus the length of the substring is endIndex-beginIndex.

Parameters:
ansiString - the specified ANSI string.
beginIndex - the beginning index, inclusive.
endIndex - the ending index, exclusive.
Returns:
the specified substring.

toLowerCase

public static char toLowerCase(char ch)
Converts the character argument to lowercase using case mapping information from the TI-92 Plus Character Codes chart.

Parameters:
ch - the character to be converted.
Returns:
the lowercase equivalent of the character, if any; otherwise, the character itself.

toUpperCase

public static char toUpperCase(char ch)
Converts the character argument to uppercase using case mapping information from the TI-92 Plus Character Codes chart.

Parameters:
ch - the character to be converted.
Returns:
the uppercase equivalent of the character, if any; otherwise, the character itself.