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
// Java program to demonstrate // baseIsLeftToRight() method import java.text.*; import java.util.*; import java.io.*; public class GFG { public static void main(String[] argv) { // creating and initializing Bidi // with base direction Bidi bidi = new Bidi( "Geeks For Geeks", Bidi.DIRECTION_LEFT_TO_RIGHT); // checking base direction // using baseIsLeftToRight() method boolean status = bidi.baseIsLeftToRight(); // display the result if (status) System.out.println( "Base direction is " + "left to right"); else System.out.println( "Base direction is " + "right to left"); } } |
Base direction is left to right
Example 2:
Java
// Java program to demonstrate // baseIsLeftToRight() method import java.text.*; import java.util.*; import java.io.*; public class GFG { public static void main(String[] argv) { // creating and initializing Bidi // with base direction Bidi bidi = new Bidi( "Tajmahal", Bidi.DIRECTION_RIGHT_TO_LEFT); // checking base direction // using baseIsLeftToRight() method boolean status = bidi.baseIsLeftToRight(); // display the result if (status) System.out.println( "Base direction is " + "left to right"); else System.out.println( "Base direction is " + "right to left"); } } |
Base direction is right to left
Reference: https://docs.oracle.com/javase/9/docs/api/java/text/Bidi.html#baseIsLeftToRight–