Bidi getRunStart() method in Java with Examples
Last Updated :
27 Nov, 2019
The getRunStart() method of java.text.Bidi class used to provide the index of the first character where the nth run starts for this Bidi instance.
Syntax:
public int getRunStart(int run)
Parameters: This method accepts the index of the logical run for which start of the run is to be retrieved.
Return Value: This method provides the index of start character for the nth logical run.
Below are the examples to illustrate the getRunStart() 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" , 0 );
int index = 0 ;
int level = bidi.getRunStart(index);
System.out.println(
"start of run for index 0 is : "
+ level);
}
}
|
Output:
start of run for index 0 is : 0
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 = 0 ;
int level = bidi.getRunStart(index);
System.out.println(
"start of run for index 0 is : "
+ level);
}
}
|
Output:
start of run for index 0 is : 0
Reference: https://docs.oracle.com/javase/9/docs/api/java/text/Bidi.html#getRunStart-int-
Like Article
Suggest improvement
Share your thoughts in the comments
Please Login to comment...