Bidi toString() method in Java with Examples
The toString() method of java.text.Bidi class is used to display this Bidi instance in string representation.
Syntax:
public String toString()
Parameter: This method accepts nothing as parameter.
Return Value: This method display internal state of bidi in string format.
Below are the examples to illustrate the toString() 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" ,
Bidi.DIRECTION_LEFT_TO_RIGHT);
String status = bidi.toString();
System.out.println( "status of bidi : "
+ status);
}
}
|
Output:
status of bidi :
sun.text.bidi.BidiBase[
dir: 0
baselevel: 0
length: 5
runs: [0 0 0 0 0]
text: [0x47 0x65 0x65 0x6b 0x73]]
Example 2:
import java.text.*;
import java.util.*;
import java.io.*;
public class GFG {
public static void main(String[] argv)
{
Bidi bidi
= new Bidi(
"TE1" ,
Bidi.DIRECTION_RIGHT_TO_LEFT);
String status = bidi.toString();
System.out.println(
"status of bidi : "
+ status);
}
}
|
Output:
status of bidi :
sun.text.bidi.BidiBase[
dir: 2
baselevel: 1
length: 3
runs: [2 2 2]
text: [0x54 0x45 0x31]]
Reference: https://docs.oracle.com/javase/9/docs/api/java/text/Bidi.html#toString–
Last Updated :
27 Nov, 2019
Like Article
Save Article
Share your thoughts in the comments
Please Login to comment...