Skip to content
Related Articles

Related Articles

Improve Article
Save Article
Like Article

Bidi baseIsLeftToRight() method in Java with Examples

  • Last Updated : 27 Nov, 2019

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 getLength() method:

Example 1:




// 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");
    }
}
Output:
Base direction is left to right

Example 2:




// 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");
    }
}
Output:
Base direction is right to left

Reference: https://docs.oracle.com/javase/9/docs/api/java/text/Bidi.html#baseIsLeftToRight–


My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!