Click here to watch in Youtube :
https://www.youtube.com/watch?v=DuF7BWTBUP4&list=UUhwKlOVR041tngjerWxVccw
Click the below Image to Enlarge
Java Tutorial : Java StringBuffer [getChars method] |
/* * public void getChars(int srcBegin, int srcEnd, char[] * dst, int dstBegin) * * Parameters: * ---------- * srcBegin - start copying at this offset. * * srcEnd - stop copying at this offset. * * dst - the array to copy the data into. * * dstBegin - offset into dst. * * Throws: * ------- * IndexOutOfBoundsException - if any of the following * is true: * * srcBegin is negative. * * dstBegin is negative. * * the srcBegin argument is greater than the srcEnd * argument. * * srcEnd is greater than this.length(). * * dstBegin+srcEnd-srcBegin is greater than dst.length. */ public class StringBufferDemo { public static void main(String[] args) { String str = "Welcome to india peter"; StringBuffer sb = new StringBuffer(str); System.out.println(sb); char[] charArray = new char[30]; /* * copies characters from starting and ending index * into the destination character array */ sb.getChars(11, 16, charArray, 0); System.out.println(charArray); } }
Welcome to india peter india
https://sites.google.com/site/javaee4321/java/StringBufferDemo_getChars_App.zip?attredirects=0&d=1
Github Link:
https://github.com/ramram43210/Java/tree/master/BasicJava/StringBufferDemo_getChars_App
Bitbucket Link:
https://bitbucket.org/ramram43210/java/src/b619d82bc2ef649a34c8b32345e1c58e65ad78f7/BasicJava/StringBufferDemo_getChars_App/?at=master
See also:
No comments:
Post a Comment