GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing www.geeksforgeeks.org — StringBuffer codePointCount() method in Java with Examples - GeeksforGeeks StringBuffer codePointCount() method in Java with ExamplesLast Updated : 30 Jul, 2019 The codePointCount() method of StringBuffer class is used to return the number of Unicode code points in the specified range of beginIndex to endIndex of String contained by StringBuffer. This method takes beginIndex and endIndex as a parameter where beginIndex is the index of the first character of the text range and endIndex is index after the last character of the text range. The indexes refer to char values (Unicode code units) and the value of index must be lie between 0 to length-1. The range starts at the beginIndex and end at the char at index endIndex – 1. Thus the length (in chars) of the text range is endIndex-beginIndex.
Syntax:
public int codePointCount(int beginIndex,
int endIndex)
Parameters: This method takes two parameters:
Output:
Example 2:
String = Welcome to GeeksforGeeks No of Unicode code points between index 4 and index 10 = 6
Output:
Example 3: To demonstrate IndexOutOfBoundsException
String = GeeksForGeeks contribute No of Unicode code points between index 13 and 17 = 4
Output:
References:
https://docs.oracle.com/javase/10/docs/api/java/lang/StringBuffer.html#codePointCount(int, int)Exception: java.lang.IndexOutOfBoundsException Comment Explore |
| You are visitor 01402503 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |