java.text.Bidi类的createLineBidi()方法用于创建具有相同基本方向并表示该范围内当前bidi的每个属性的新的bidi对象。
用法:
public Bidi createLineBidi(int lineStart, int lineLimit)
参数:此方法将以下参数作为参数
- lineStart:这是这个新比迪烟的起点
- lineLimit:这是此新比迪烟的终点
返回值:此方法返回一个新的Bidi对象
下面是说明createLineBidi()方法的示例:
示例1:
// Java program to demonstrate
// createLineBidi() method
import java.text.*;
import java.util.*;
import java.io.*;
public class GFG {
public static void main(String[] argv)
{
// creating and initializing Bidi
// text with base direction
Bidi bidi
= new Bidi(
"Geeks For Geeks",
Bidi.DIRECTION_RIGHT_TO_LEFT);
// creating and new bidi Object using the old one
// using createLineBidi() method
Bidi newbidi = bidi.createLineBidi(1, 6);
// display the new bidi status
System.out.println("New Bidi "
+ "\nLength : "
+ newbidi.getLength()
+ "\nnumber of levels : "
+ newbidi.getRunCount()
+ "\nBase Level : "
+ newbidi.getBaseLevel());
}
}
输出:
New Bidi Length : 5 number of levels : 2 Base Level : 1
示例2:
// Java program to demonstrate
// createLineBidi() method
import java.text.*;
import java.util.*;
import java.io.*;
public class GFG {
public static void main(String[] argv)
{
// creating and initializing Bidi
// text with base direction
Bidi bidi
= new Bidi("Tajmahal",
Bidi.DIRECTION_RIGHT_TO_LEFT);
// creating and new bidi Object using the old one
// using createLineBidi() method
Bidi newbidi = bidi.createLineBidi(3, 5);
// display the new bidi status
System.out.println("New Bidi "
+ "\nLength : "
+ newbidi.getLength()
+ "\nnumber of levels : "
+ newbidi.getRunCount()
+ "\nBase Level : "
+ newbidi.getBaseLevel());
}
}
输出:
New Bidi Length : 2 number of levels : 1 Base Level : 2
参考: https://docs.oracle.com/javase/9/docs/api/java/text/Bidi.html#createLineBidi-int-int-
相关用法
- Java Bidi getLength()用法及代码示例
- Java Bidi baseIsLeftToRight()用法及代码示例
- Java Bidi isLeftToRight()用法及代码示例
- Java Bidi toString()用法及代码示例
- Java Bidi getRunStart()用法及代码示例
- Java Bidi getLevelAt()用法及代码示例
- Java Bidi getBaseLevel()用法及代码示例
- Java Bidi getRunLevel()用法及代码示例
- Java Bidi getRunCount()用法及代码示例
- Java Bidi getRunLimit()用法及代码示例
- Java Bidi isRightToLeft()用法及代码示例
- Java Java lang.Long.numberOfLeadingZeros()用法及代码示例
- Java Java lang.Long.byteValue()用法及代码示例
- Java Java lang.Long.highestOneBit()用法及代码示例
- Java Java lang.Long.builtcount()用法及代码示例
注:本文由纯净天空筛选整理自RohitPrasad3大神的英文原创作品 Bidi createLineBidi() method in Java with Examples。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。