Bidi createLineBidi() method in Java with Examples
Last Updated :
27 Nov, 2019
The createLineBidi() method of java.text.Bidi class is used to create a new bidi object having same base direction and representing every property of current bidi within the range.
Syntax:
public Bidi createLineBidi(int lineStart,
int lineLimit)
Parameter: This method takes following argument as parameter
- lineStart: it is the start point of this new bidi
- lineLimit: it is the end point for this new bidi
Return Value: This method return a new Bidi object
Below are the examples to illustrate the createLineBidi() method:
Example 1:
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_RIGHT_TO_LEFT);
Bidi newbidi = bidi.createLineBidi( 1 , 6 );
System.out.println( "New Bidi "
+ "\nLength : "
+ newbidi.getLength()
+ "\nnumber of levels : "
+ newbidi.getRunCount()
+ "\nBase Level : "
+ newbidi.getBaseLevel());
}
}
|
Output:
New Bidi
Length : 5
number of levels : 2
Base Level : 1
Example 2:
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);
Bidi newbidi = bidi.createLineBidi( 3 , 5 );
System.out.println( "New Bidi "
+ "\nLength : "
+ newbidi.getLength()
+ "\nnumber of levels : "
+ newbidi.getRunCount()
+ "\nBase Level : "
+ newbidi.getBaseLevel());
}
}
|
Output:
New Bidi
Length : 2
number of levels : 1
Base Level : 2
Reference: https://docs.oracle.com/javase/9/docs/api/java/text/Bidi.html#createLineBidi-int-int-
Like Article
Suggest improvement
Share your thoughts in the comments
Please Login to comment...