Last Updated : 06 Dec, 2018
The
java.lang.Character.isUnicodeIdentifierPart()is an inbuilt method in java that determines if the specified character may be part of a Unicode identifier as other than the first character. A character may be part of a Unicode identifier if and only if one of the following statements is true:
public static boolean isUnicodeIdentifierPart(datatype character)Parameter:
The function accepts one mandatory parameter
character. This parameter can be of datatype int or char. It specifies the character to be tested.
Return Value:This method returns true if the character may be part of a Unicode identifier, otherwise false. Below programs illustrate the java.lang.Character.isUnicodeIdentifierPart() method:
Program 1:When the passed parameter is a Character.
Java
// Code to illustrate the Character.isUnicodeIdentifierPart()
import java.lang.*;
public class gfg {
public static void main(String[] args)
{
// Creating character primitives
char char1 = '-';
char char2 = '7';
char char3 = 'g';
boolean bool1 = Character.isUnicodeIdentifierPart(char1);
boolean bool2 = Character.isUnicodeIdentifierPart(char2);
boolean bool3 = Character.isUnicodeIdentifierPart(char3);
String str1 = " Is " + char1 + " a part of Unicode Identifier: " + bool1;
String str2 = " Is " + char2 + " a part of Unicode Identifier: " + bool2;
String str3 = " Is " + char3 + " a part of Unicode Identifier: " + bool3;
// Displaying the strings
System.out.println(str1);
System.out.println(str2);
System.out.println(str3);
}
}
Output:
Is - a part of Unicode Identifier: false Is 7 a part of Unicode Identifier: true Is g a part of Unicode Identifier: trueProgram 2:
When the passed parameter is a Character.
Java
// Code to illustrate the Character.isUnicodeIdentifierPart()
import java.lang.*;
public class gfg {
public static void main(String[] args)
{
// Create 2 char primitives c1, c2
char c1 = '~', c2 = '8';
boolean bool1 = Character.isUnicodeIdentifierPart(c1);
boolean bool2 = Character.isUnicodeIdentifierPart(c2);
String str1 = c1 + " may be part of a Unicode identifier is " + bool1;
String str2 = c2 + " may be part of a Unicode identifier is " + bool2;
System.out.println(str1);
System.out.println(str2);
}
}
Output:
~ may be part of a Unicode identifier is false 8 may be part of a Unicode identifier is true
Below programs illustrate the Character.isUnicodeIdentifierPart(int codePoint) method:
Program 1: Java
// Code to illustrate the Character.isUnicodeIdentifierPart(int codePoint)
import java.lang.*;
public class gfg {
public static void main(String[] args)
{
// Create 2 int primitives c1, c2
int c1 = 0x053d, c2 = 0x7840;
boolean bool1 = Character.isUnicodeIdentifierPart(c1);
boolean bool2 = Character.isUnicodeIdentifierPart(c2);
String str1 = "c1 may be part of a Unicode identifier is " + bool1;
String str2 = "c2 may be part of a Unicode identifier is " + bool2;
// Displaying the strings
System.out.println(str1);
System.out.println(str2);
}
}
Output:
c1 may be part of a Unicode identifier is true c2 may be part of a Unicode identifier is trueProgram 2: Java
// Code to illustrate the Character.isUnicodeIdentifierPart(int codePoint)
import java.lang.*;
public class gfg {
public static void main(String[] args)
{
// Creating 2 int primitives c1, c2
int c1 = 0x065d, c2 = 0x7885;
boolean bool1 = Character.isUnicodeIdentifierPart(c1);
boolean bool2 = Character.isUnicodeIdentifierPart(c2);
String str1 = "c1 may be part of a Unicode identifier is " + bool1;
String str2 = "c2 may be part of a Unicode identifier is " + bool2;
// Displaying the strings
System.out.println(str1);
System.out.println(str2);
}
}
Output:
c1 may be part of a Unicode identifier is true c2 may be part of a Unicode identifier is trueReference
:
https://docs.oracle.com/javase/7/docs/api/java/lang/Character.html#isUnicodeIdentifierPart(char)RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4