Overview | Methods | This Package | All Packages
Converts an object to a character.
Syntax
public static char toChar( Object value )
Parameters
value
The value to convert.
Return Value
Returns a character that represents the object.
Exceptions
ClassCastException thrown if the argument cannot be converted.
Remarks
The following table lists the supported argument types and the resulting conversion.
Type | Conversion |
null | Returns 0. |
Character | Returns the character stored in the object. Produced by calling Character.charValue. |
Number | Returns the character value of the object. Produced by calling Number.shortValue and coercing the result to char. |
String | Returns the first character of the string, or returns zero if the length of the string is zero. |
Variant | Returns the character value of the variant. Produced by calling Variant.toShort and coercing the result to char. |
See Also toObject