Package java.lang
Class String

Public Method getChars

char[] getChars()

Throws:

void getChars(int srcBegin, int srcEnd, char[] dst, int dstBegin)

Throws:

_INSERT_METHOD_SIGNATURE_HERE_

Description:

getChars() method:

Returns the characters of this String into a character array.

getChars(srcBegin, srcEnd, dst, dstBegin) method:

Copies characters from this string into the destination character array. The first character (starting with 0) is at position srcBegin, the last at position srcEnd-1. The characters are copied into the subarray of dst starting at index dstBegin. The destination array has to be big enough to hold the returned characters.

Examples

byte[] arr = "bäü∀".getChars(); // returns [0x62 (0xC3 0xA4) (0xC3 0xBC) (0xE2 0x88 0x80)]

"0123∀".getChars(2, 5, arr, 0); // chars 2,3 and ∀ will be converted to bytes and inserted into
                                // arr at position 0 resulting in [0x32, 0x33, 0xE2]