unicodeWrap
Formats a string of given directionality for use in plain-text output of the context directionality, so an opposite-directionality string is neither garbled nor garbles its surroundings. This makes use of Unicode bidi formatting characters.
The algorithm: In case the given directionality doesn't match the context directionality, wraps the string with Unicode bidi formatting characters: RLE+str
+PDF for RTL text, or LRE+str
+PDF for LTR text.
If isolate
, directionally isolates the string so that it does not garble its surroundings. Currently, this is done by "resetting" the directionality after the string by appending a trailing Unicode bidi mark matching the context directionality (LRM or RLM) when either the overall directionality or the exit directionality of the string is opposite to that of the context. Unless the formatter was built using stereoReset with a false
argument, also prepends a Unicode bidi mark matching the context directionality when either the overall directionality or the entry directionality of the string is opposite to that of the context. Note that as opposed to the overall directionality, the entry and exit directionalities are determined from the string itself.
Does *not* do HTML-escaping.
Return
Input string after applying the above processing. null
if str
is null
.
Parameters
The input string.
The algorithm to be used to estimate the string's overall direction.
Whether to directionally isolate the string to prevent it from garbling the content around it
Operates like unicodeWrap, but takes a CharSequence instead of a string
Return
Input CharSequence after applying the above processing. null
if str
is null
.
Parameters
The input CharSequence.
The algorithm to be used to estimate the CharSequence's overall direction. See androidx.core.text.TextDirectionHeuristicsCompat for pre-defined heuristics.
Whether to directionally isolate the CharSequence to prevent it from garbling the content around it
Operates like unicodeWrap, but assumes isolate
is true.
Return
Input string after applying the above processing.
Parameters
The input string.
The algorithm to be used to estimate the string's overall direction.
Operates like unicodeWrap, but assumes isolate
is true.
Return
Input CharSequence after applying the above processing.
Parameters
The input CharSequence.
The algorithm to be used to estimate the CharSequence's overall direction. See androidx.core.text.TextDirectionHeuristicsCompat for pre-defined heuristics.
Operates like unicodeWrap, but uses the formatter's default direction estimation algorithm.
Return
Input string after applying the above processing.
Parameters
The input string.
Whether to directionally isolate the string to prevent it from garbling the content around it
Operates like unicodeWrap, but uses the formatter's default direction estimation algorithm.
Return
Input CharSequence after applying the above processing.
Parameters
The input CharSequence.
Whether to directionally isolate the CharSequence to prevent it from garbling the content around it
Operates like unicodeWrap, but uses the formatter's default direction estimation algorithm and assumes isolate
is true.
Return
Input string after applying the above processing.
Parameters
The input string.
Operates like unicodeWrap, but uses the formatter's default direction estimation algorithm and assumes isolate
is true.
Return
Input CharSequence after applying the above processing.
Parameters
The input CharSequence.