Java StringBuilder.getChars(int srcBegin, int srcEnd, char[] dst, int dstBegin)
Syntax
StringBuilder.getChars(int srcBegin, int srcEnd, char[] dst, int dstBegin) has the following syntax.
public void getChars(int srcBegin, int srcEnd, char[] dst, int dstBegin)
Example
In the following code shows how to use StringBuilder.getChars(int srcBegin, int srcEnd, char[] dst, int dstBegin) method.
public class Main {
public static void main(String args[]) {
StringBuilder buffer = new StringBuilder("hello there from java2s.com");
//from www .ja v a 2 s . c o m
char charArray[] = new char[buffer.length()];
buffer.getChars(0, buffer.length(), charArray, 0);
System.out.print("The characters are: ");
}
}
The code above generates the following result.