public class BidiUtils
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
boolean |
endsWithLtr(java.lang.String str)
Like
endsWithLtr(String, boolean) , but assumes str is not
HTML / HTML-escaped. |
boolean |
endsWithLtr(java.lang.String str,
boolean isHtml)
Check whether the last strongly-directional character in the string is LTR.
|
boolean |
endsWithRtl(java.lang.String str)
Like
endsWithRtl(String, boolean) , but assumes str is not
HTML / HTML-escaped. |
boolean |
endsWithRtl(java.lang.String str,
boolean isHtml)
Check whether the last strongly-directional character in the string is RTL.
|
HasDirection.Direction |
estimateDirection(java.lang.String str)
Like
estimateDirection(String, boolean) , but assumes str
is not HTML / HTML-escaped. |
HasDirection.Direction |
estimateDirection(java.lang.String str,
boolean isHtml)
Estimates the directionality of a string based on relative word counts.
|
static BidiUtils |
get()
Get an instance of BidiUtils.
|
boolean |
hasAnyLtr(java.lang.String str)
Like
hasAnyLtr(String, boolean) , but assumes str is not
HTML / HTML-escaped. |
boolean |
hasAnyLtr(java.lang.String str,
boolean isHtml)
Checks if the given string has any LTR characters in it.
|
boolean |
hasAnyRtl(java.lang.String str)
Like
hasAnyRtl(String, boolean) , but assumes str is not
HTML / HTML-escaped. |
boolean |
hasAnyRtl(java.lang.String str,
boolean isHtml)
Checks if the given string has any RTL characters in it.
|
boolean |
startsWithLtr(java.lang.String str)
Like
startsWithLtr(String, boolean) , but assumes str is
not HTML / HTML-escaped. |
boolean |
startsWithLtr(java.lang.String str,
boolean isHtml)
Check whether the first strongly-directional character in the string is
LTR.
|
boolean |
startsWithRtl(java.lang.String str)
Like
startsWithRtl(String, boolean) , but assumes str is
not HTML / HTML-escaped. |
boolean |
startsWithRtl(java.lang.String str,
boolean isHtml)
Check whether the first strongly-directional character in the string is
RTL.
|
(package private) java.lang.String |
stripHtmlIfNeeded(java.lang.String str,
boolean isStripNeeded)
Returns the input text with spaces instead of HTML tags or HTML escapes, if
isStripNeeded is true.
|
public static BidiUtils get()
public boolean endsWithLtr(java.lang.String str)
endsWithLtr(String, boolean)
, but assumes str
is not
HTML / HTML-escaped.public boolean endsWithLtr(java.lang.String str, boolean isHtml)
str
- the string to checkisHtml
- whether str is HTML / HTML-escapedpublic boolean endsWithRtl(java.lang.String str)
endsWithRtl(String, boolean)
, but assumes str
is not
HTML / HTML-escaped.public boolean endsWithRtl(java.lang.String str, boolean isHtml)
str
- the string to checkisHtml
- whether str is HTML / HTML-escapedpublic HasDirection.Direction estimateDirection(java.lang.String str)
estimateDirection(String, boolean)
, but assumes str
is not HTML / HTML-escaped.public HasDirection.Direction estimateDirection(java.lang.String str, boolean isHtml)
str
- the string to checkisHtml
- whether str
is HTML / HTML-escaped. Use this to
ignore HTML tags and escapes that would otherwise be mistaken for
LTR text.public boolean hasAnyLtr(java.lang.String str)
hasAnyLtr(String, boolean)
, but assumes str
is not
HTML / HTML-escaped.str
- the string to be testedpublic boolean hasAnyLtr(java.lang.String str, boolean isHtml)
str
- the string to be testedisHtml
- whether str is HTML / HTML-escapedpublic boolean hasAnyRtl(java.lang.String str)
hasAnyRtl(String, boolean)
, but assumes str
is not
HTML / HTML-escaped.str
- the string to be testedpublic boolean hasAnyRtl(java.lang.String str, boolean isHtml)
isHtml
- whether str is HTML / HTML-escapedstr
- the string to be testedpublic boolean startsWithLtr(java.lang.String str)
startsWithLtr(String, boolean)
, but assumes str
is
not HTML / HTML-escaped.public boolean startsWithLtr(java.lang.String str, boolean isHtml)
str
- the string to checkisHtml
- whether str is HTML / HTML-escapedpublic boolean startsWithRtl(java.lang.String str)
startsWithRtl(String, boolean)
, but assumes str
is
not HTML / HTML-escaped.public boolean startsWithRtl(java.lang.String str, boolean isHtml)
str
- the string to checkisHtml
- whether str
is HTML / HTML-escapedjava.lang.String stripHtmlIfNeeded(java.lang.String str, boolean isStripNeeded)