Click here to watch in Youtube :
https://www.youtube.com/watch?v=pb2rT6r69m4&list=UUhwKlOVR041tngjerWxVccw
Click the below Image to Enlarge
Java Tutorial : Java String [codePointCount(int beginIndex,int endIndex) method] |
/* * public int codePointCount(int beginIndex, int * endIndex) * * Parameters: * ---------- * beginIndex - the index to the first char of the text * range. * * endIndex - the index after the last char of * the text range. * * Returns: * ------- * the number of Unicode code points in the specified * text range * * Throws: * ------ * IndexOutOfBoundsException - if the beginIndex is * negative, or endIndex is larger than the length of * this String, or beginIndex is larger than endIndex. */ public class CodePointCountDemo { public static void main(String[] args) { String str = "JAVA programming language"; System.out.println("String = " + str); int retval = str.codePointCount(1, 8); System.out.println("Codepoint count = " + retval); } }Output
String = JAVA programming language Codepoint count = 7Click the below link to download the code:
https://sites.google.com/site/javaee4321/java/StringDemo_codePointCount_App.zip?attredirects=0&d=1
Github Link:
https://github.com/ramram43210/Java/tree/master/BasicJava/StringDemo_codePointCount_App
Bitbucket Link:
https://bitbucket.org/ramram43210/java/src/12836b6e32056aa84ee5263036ba2429cc0bd845/BasicJava/StringDemo_codePointCount_App/?at=master
See also:
No comments:
Post a Comment