Bidi getRunLimit() method in Java with Examples
The getRunLimit() method of java.text.Bidi class is used to provide the (index +1) value of the last character where the last run ends of this Bidi instance.
Syntax:
public int getRunLimit(int run)
Parameters: This method accepts the index of the run for which Run limit is to be retrieved.
Return Value: This method provides the length of the line for the last run.
Below are the examples to illustrate the getRunLimit() 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( "Tajmahal" , 1 );
int index = 1 ;
int level = bidi.getRunLimit(index);
System.out.println(
"level of first run is : "
+ level);
}
}
|
Output:
level of first run is : 8
Example 2:
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" , 1 );
int index = 1 ;
int level = bidi.getRunLimit(index);
System.out.println(
"level of first run is : "
+ level);
}
}
|
Output:
level of first run is : 15
Reference: https://docs.oracle.com/javase/9/docs/api/java/text/Bidi.html#getRunLimit-int-
Last Updated :
27 Nov, 2019
Like Article
Save Article
Share your thoughts in the comments
Please Login to comment...