Java Character codePointCount() Method6 Nov 2024 | 4 min read This Method has 2 types of syntax. Java Character codePointCount(char[]a, int offset, int count) MethodThe codePointCount(char[]a, int offset, int count) method is used to return the number of Unicode code points in the sub array of the char array. The offset argument is the index of the first char in the given char array and the count argument indicates the length of the sub array. SyntaxParameterThe above method requires three parameters:
Return ValueThis method returns the number of Unicode code point in the specified sub array. Example 1Output: Welcome to our tutorial site: The result is given as: 2 Example 2Output: The alphabets are: 'a', 'b', 'c', 'd', 'e' The number of Unicode code point for alphabets are 4 The numbers are: '1', '2', '3', '4', '5' The number of Unicode code point for numbers are 3 Example 3Output: Hello everyone 6 is generated because method counts the first argument. Everyday is a fun day 2 is generated because method counts the second argument. Java Character codePointCount()MethodThe codePointCount(CharSequence seq, int beginIndex, int endIndex) method of Character class is used to return the number of Unicode code points in the text range of a particular char sequence. The text range begins from the beginIndex and ends at endIndex. SyntaxParameterThe above method requires three parameters:
Return ValueThe codePointCount(CharSequence seq, int beginIndex, int endIndex) method returns the number of Unicode code points in the specified text range. Example 4Output: This is a unique example! The result comes to be:25 Example 5Output: This is a unique example! The result comes to be:25 Hello World! Number of Unicode code points is 4 Example 6Output: This is a unique example! The result comes to be: 25 Java is a high level language! The result comes to be: 30 Java is based on the cocepts of OOPS! The result comes to be: 37 Next TopicJava-character-compare-method |
The isJavaIdentifierStart(char ch) method of Character class determines whether the given(or specified) character is considered as the first character in a Java identifier or not. A character may start a Java identifier if and only if any of the following conditions is true: isLetter(ch) returns true. getType(ch) returns LETTER_NUMBER. The...
4 min read
The forDigit(int digit, int radix) method of character class determines the character representation for a specific digit in the specified radix. If the value of the digit is not a valid digit in the specified radix or if the value of the radix is not a...
3 min read
Java Character.isUnicodeIdentifierStart() is a method of the Character class and helps find valid starting characters for Unicode identifiers. When coding, we have to follow rules referring to Identifiers names, variable names and class names as well as method names in order that the program has...
5 min read
The isDigit(int codePoint) method of Character class generally determines whether the given character is a digit or not. Generally, a character is considered as a digit if its general category given by getType(codePoint), is DECIMAL_DIGIT_NUMBER. Syntax public static boolean isDigit(int codePoint) Parameter The above method requires only one parameter: a.)The codePoint...
6 min read
The isJavaIdentifierPart(char ch) method of character class determines whether the given (or specified) character is a part of Java identifier or not. The given character is a part of a Java identifier if any of the following condition is true: The character is a letter. The character is a...
6 min read
The isSpaceChar(char ch) method of Character class determines whether the given(or specified) character is a Unicode space character. The given(or specified) character is considered to be a space character if the character is specified as a space character by the Unicode Standard. The above method returns true...
4 min read
The equals(Object obj) method of character class compares the object with the specified object. The result is true if and only if the argument is not null and the Character object has the same char value as represented by the object. Syntax public boolean equals(Object obj) Parameter The above method...
2 min read
The getName(int codePoint) method returns the Unicode name of the specified character or null if the codePoint is unassigned. If the Unicode Data file does not assign the specified character a name, the returned name is same as the result of the expression. Character.UnicodeBlock.of(codePoint).toString().replace('-'), ' ...
2 min read
The highSurrogate(intcodePoint) method of Character class generally returns the current surrogate codePoint for the given surrogate pair which indicates the supplementary character in the UTF encoding. If the given character is not specified(or valid), an unspecified char is returned. Syntax public static char highSurrogate(int codePoint) Parameter codePoint: It is a...
2 min read
The isLowSurrogate(char ch) method of character class determines whether the given(or specified) character is a Unicode low-surrogate code unit (which is also known as trailing-surrogate code unit). These values do not represent the characters by themselves, rather than these values are used to represent the supplementary characters...
5 min read
We request you to subscribe our newsletter for upcoming updates.
We provides tutorials and interview questions of all technology like java tutorial, android, java frameworks
G-13, 2nd Floor, Sec-3, Noida, UP, 201301, India