本文整理了Java中java.lang.Character.getDirectionality()
方法的一些代码示例,展示了Character.getDirectionality()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Character.getDirectionality()
方法的具体详情如下:
包路径:java.lang.Character
类名称:Character
方法名:getDirectionality
[英]Gets the Unicode directionality of the specified character.
[中]获取指定字符的Unicode方向性。
代码示例来源:origin: robovm/robovm
/**
* Gets the Unicode directionality of the specified character.
*
* @param c
* the character to get the directionality of.
* @return the Unicode directionality of {@code c}.
*/
public static byte getDirectionality(char c) {
return getDirectionality((int)c);
}
代码示例来源:origin: stackoverflow.com
public static boolean isRTL() {
return isRTL(Locale.getDefault());
}
public static boolean isRTL(Locale locale) {
final int directionality = Character.getDirectionality(locale.getDisplayName().charAt(0));
return directionality == Character.DIRECTIONALITY_RIGHT_TO_LEFT ||
directionality == Character.DIRECTIONALITY_RIGHT_TO_LEFT_ARABIC;
}
代码示例来源:origin: org.mongodb/mongo-java-driver
final byte directionality = Character.getDirectionality(codepoint);
final boolean isRandALcat = directionality == Character.DIRECTIONALITY_RIGHT_TO_LEFT
|| directionality == Character.DIRECTIONALITY_RIGHT_TO_LEFT_ARABIC;
代码示例来源:origin: wildfly/wildfly
switch (Character.getDirectionality(cp)) {
case Character.DIRECTIONALITY_RIGHT_TO_LEFT_ARABIC:
case Character.DIRECTIONALITY_RIGHT_TO_LEFT: // R/AL character
代码示例来源:origin: wildfly/wildfly
switch (Character.getDirectionality(cp)) {
case Character.DIRECTIONALITY_RIGHT_TO_LEFT_ARABIC:
case Character.DIRECTIONALITY_RIGHT_TO_LEFT: // R/AL character
代码示例来源:origin: tabulapdf/tabula-java
@Override public int isLtrDominant() {
int ltrCnt = 0;
int rtlCnt = 0;
for (int i = 0; i < this.getTextElements().size(); i++) {
String elementText = this.getTextElements().get(i).getText();
for (int j = 0; j < elementText.length(); j++) {
byte dir = Character.getDirectionality(elementText.charAt(j));
if ((dir == Character.DIRECTIONALITY_LEFT_TO_RIGHT) ||
(dir == Character.DIRECTIONALITY_LEFT_TO_RIGHT_EMBEDDING) ||
(dir == Character.DIRECTIONALITY_LEFT_TO_RIGHT_OVERRIDE)) {
ltrCnt++;
} else if ((dir == Character.DIRECTIONALITY_RIGHT_TO_LEFT) ||
(dir == Character.DIRECTIONALITY_RIGHT_TO_LEFT_ARABIC) ||
(dir == Character.DIRECTIONALITY_RIGHT_TO_LEFT_EMBEDDING) ||
(dir == Character.DIRECTIONALITY_RIGHT_TO_LEFT_OVERRIDE)) {
rtlCnt++;
}
}
}
return java.lang.Integer.compare(ltrCnt, rtlCnt); // 1 is LTR, 0 is neutral, -1 is RTL
}
代码示例来源:origin: tabulapdf/tabula-java
buffDirectionality = directionalities.get(Character.getDirectionality(te.getText().charAt(0)));
} else {
if (buffDirectionality == DirectionalityOptions.NONE) {
buffDirectionality = directionalities.get(Character.getDirectionality(te.getText().charAt(0)));
DirectionalityOptions teDirectionality = directionalities.get(Character.getDirectionality(te.getText().charAt(0)));
if (Character.getDirectionality(te.getText().charAt(0)) == java.lang.Character.DIRECTIONALITY_WHITESPACE && (buffDirectionality == (isLtrDominant ? DirectionalityOptions.RTL : DirectionalityOptions.LTR))) {
buff.add(0, te);
} else {
buffDirectionality = directionalities.get(Character.getDirectionality(te.getText().charAt(0)));
buff = new ArrayList<>();
buff.add(te);
代码示例来源:origin: MobiVM/robovm
/**
* Gets the Unicode directionality of the specified character.
*
* @param c
* the character to get the directionality of.
* @return the Unicode directionality of {@code c}.
*/
public static byte getDirectionality(char c) {
return getDirectionality((int)c);
}
代码示例来源:origin: ibinti/bugvm
/**
* Gets the Unicode directionality of the specified character.
*
* @param c
* the character to get the directionality of.
* @return the Unicode directionality of {@code c}.
*/
public static byte getDirectionality(char c) {
return getDirectionality((int)c);
}
代码示例来源:origin: com.bugvm/bugvm-rt
/**
* Gets the Unicode directionality of the specified character.
*
* @param c
* the character to get the directionality of.
* @return the Unicode directionality of {@code c}.
*/
public static byte getDirectionality(char c) {
return getDirectionality((int)c);
}
代码示例来源:origin: stackoverflow.com
if (Character.getDirectionality(string.charAt(0)) == Character.DIRECTIONALITY_RIGHT_TO_LEFT
|| Character.getDirectionality(string.charAt(0)) == Character.DIRECTIONALITY_RIGHT_TO_LEFT_ARABIC
|| Character.getDirectionality(string.charAt(0)) == Character.DIRECTIONALITY_RIGHT_TO_LEFT_EMBEDDING
|| Character.getDirectionality(string.charAt(0)) == Character.DIRECTIONALITY_RIGHT_TO_LEFT_OVERRIDE
) {
// it is a RTL string
}
代码示例来源:origin: kingargyle/adt-leanback-support
/**
* Gets the bidi character class, i.e. Character.getDirectionality(), of a given char, using
* a cache for speed. Not designed for supplementary codepoints, whose results we do not
* cache.
*/
private static byte getCachedDirectionality(char c) {
return c < DIR_TYPE_CACHE_SIZE ? DIR_TYPE_CACHE[c] : Character.getDirectionality(c);
}
代码示例来源:origin: kingargyle/adt-leanback-support
@Override
public int checkRtl(CharSequence cs, int start, int count) {
int result = STATE_UNKNOWN;
for (int i = start, e = start + count; i < e && result == STATE_UNKNOWN; ++i) {
result = isRtlTextOrFormat(Character.getDirectionality(cs.charAt(i)));
}
return result;
}
代码示例来源:origin: net.sf.cssbox/pdf2dom
protected byte getTextDirectionality(String s)
{
if (s.length() > 0)
return Character.getDirectionality(s.charAt(0));
else
return Character.DIRECTIONALITY_UNDEFINED;
}
代码示例来源:origin: Ronak-LM/memoir
private static boolean isRTL(Locale locale) {
int directionality = Character.getDirectionality(locale.getDisplayName().charAt(0));
return directionality == Character.DIRECTIONALITY_RIGHT_TO_LEFT ||
directionality == Character.DIRECTIONALITY_RIGHT_TO_LEFT_ARABIC;
}
代码示例来源:origin: YeDaxia/Android-YRichEditor
public static boolean isRTL(Locale locale) {
final int directionality = Character.getDirectionality(locale.getDisplayName().charAt(0));
return directionality == Character.DIRECTIONALITY_RIGHT_TO_LEFT ||
directionality == Character.DIRECTIONALITY_RIGHT_TO_LEFT_ARABIC;
}
代码示例来源:origin: gigabytedevelopers/FireFiles
public static boolean isRTL(Locale locale) {
final int directionality = Character.getDirectionality(locale.getDisplayName().charAt(0));
return directionality == Character.DIRECTIONALITY_RIGHT_TO_LEFT ||
directionality == Character.DIRECTIONALITY_RIGHT_TO_LEFT_ARABIC;
}
代码示例来源:origin: chengzichen/KrGallery
public static boolean isRTL() {
final int directionality = Character.getDirectionality(Locale.getDefault().getDisplayName().charAt(0));
return directionality == Character.DIRECTIONALITY_RIGHT_TO_LEFT ||
directionality == Character.DIRECTIONALITY_RIGHT_TO_LEFT_ARABIC;
}
代码示例来源:origin: stackoverflow.com
public static boolean isRTL() {
return isRTL(Locale.getDefault());
}
public static boolean isRTL(Locale locale) {
return
Character.getDirectionality(locale.getDisplayName().charAt(0)) ==
Character.DIRECTIONALITY_RIGHT_TO_LEFT;
}
代码示例来源:origin: Catrobat/Paintroid
public static boolean checkTextDirection(String string) {
return Character.getDirectionality(string.charAt(0)) == Character.DIRECTIONALITY_RIGHT_TO_LEFT
|| Character.getDirectionality(string.charAt(0)) == Character.DIRECTIONALITY_RIGHT_TO_LEFT_ARABIC;
}
}
内容来源于网络,如有侵权,请联系作者删除!