Bidi baseIsLeftToRight() method in Java with Examples
Last Updated :
19 Jan, 2023
The baseIsLeftToRight() method of java.text.Bidi class is used to check if this Bidi instance has left to right base direction or not.
Syntax:
public boolean baseIsLeftToRight()
Parameter: This method accepts nothing as parameter.
Return Value: This method return true if this bidi has left to right base direction otherwise false.
Below are the examples to illustrate the baseIsLeftToRight() method:
Example 1:
Java
import java.text.*;
import java.util.*;
import java.io.*;
public class GFG {
public static void main(String[] argv)
{
Bidi bidi
= new Bidi(
"Geeks For Geeks",
Bidi.DIRECTION_LEFT_TO_RIGHT);
boolean status
= bidi.baseIsLeftToRight();
if (status)
System.out.println(
"Base direction is "
+ "left to right");
else
System.out.println(
"Base direction is "
+ "right to left");
}
}
|
Output:
Base direction is left to right
Example 2:
Java
import java.text.*;
import java.util.*;
import java.io.*;
public class GFG {
public static void main(String[] argv)
{
Bidi bidi
= new Bidi(
"Tajmahal",
Bidi.DIRECTION_RIGHT_TO_LEFT);
boolean status
= bidi.baseIsLeftToRight();
if (status)
System.out.println(
"Base direction is "
+ "left to right");
else
System.out.println(
"Base direction is "
+ "right to left");
}
}
|
Output:
Base direction is right to left
Reference: https://docs.oracle.com/javase/9/docs/api/java/text/Bidi.html#baseIsLeftToRight–
Like Article
Suggest improvement
Share your thoughts in the comments
Please Login to comment...