Converts an object to a character.
public static char toChar( Object value )
value
The value to convert.
Returns a character that represents the object.
ClassCastException thrown if the argument cannot be converted.
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