Java String.getChars(int srcBegin, int srcEnd, char[] dst, int dstBegin)

Syntax

String.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 String.getChars(int srcBegin, int srcEnd, char[] dst, int dstBegin) method.

 
public class Main {
  public static void main(String args[]) {
//w w w  . j a v  a2s .c  om
    String s = "This is a test string from java2s.com.";
    int start = 10;
    int end = 14;
    char buf[] = new char[end - start];

    s.getChars(start, end, buf, 0);
    System.out.println(buf);
  }
}

Here is the output of this program:





















Home »
  Java Tutorial »
    java.lang »




Boolean
Byte
Character
Class
Double
Enum
Float
Integer
Long
Math
Number
Object
Package
Process
ProcessBuilder
Runnable
Runtime
SecurityManager
Short
StackTraceElement
StrictMath
String
StringBuffer
StringBuilder
System
Thread
ThreadGroup
ThreadLocal
Throwable