compat/src/main/java/androidx/core/text/BidiFormatter.java
public CharSequence unicodeWrap(CharSequence str, TextDirectionHeuristicCompat heuristic,
            boolean isolate) {
        if (str == null) return null;
        final boolean isRtl = heuristic.isRtl(str, 0, str.length());
        SpannableStringBuilder result = new SpannableStringBuilder();
        if (getStereoReset() && isolate) {
            result.append(markBefore(str,
                    isRtl ? TextDirectionHeuristicsCompat.RTL : TextDirectionHeuristicsCompat.LTR));
        }
        if (isRtl != mIsRtlContext) {
            result.append(isRtl ? RLE : LRE);
            result.append(str);
            result.append(PDF);
        } else {
            result.append(str);
        }
        if (isolate) {
            result.append(markAfter(str,
                    isRtl ? TextDirectionHeuristicsCompat.RTL : TextDirectionHeuristicsCompat.LTR));
        }
        return result;
    }
/**
     * Operates like {@link #unicodeWrap(String,
     * androidx.core.text.TextDirectionHeuristicCompat, boolean)}, but takes a CharSequence
     * instead of a string
     *
     * @param str The input CharSequence.
     * @param heuristic The algorithm to be used to estimate the CharSequence's overall direction.
     *        See {@link androidx.core.text.TextDirectionHeuristicsCompat} for pre-defined
     *        heuristics.
     * @param isolate Whether to directionally isolate the CharSequence to prevent it from garbling
     *     the content around it
     * @return Input CharSequence after applying the above processing. {@code null} if {@code str}
     *     is {@code null}.
     */
Operates like {@link #unicodeWrap(String,
androidx.core.text.TextDirectionHeuristicCompat, boolean)}, but takes a CharSequence
instead of a string

@param str The input CharSequence.
@param heuristic The algorithm to be used to estimate the CharSequence's overall direction.
See  androidx.core.text.TextDirectionHeuristicsCompat for pre-defined
heuristics.
@param isolate Whether to directionally isolate the CharSequence to prevent it from garbling
the content around it
@return Input CharSequence after applying the above processing.  null if  str
is  null.
Operates like { @link #unicodeWrap ( String androidx . core . text . TextDirectionHeuristicCompat boolean ) } but takes a CharSequence instead of a string @param str The input CharSequence . @param heuristic The algorithm to be used to estimate the CharSequence ' s overall direction . See androidx . core . text . TextDirectionHeuristicsCompat for pre - defined heuristics . @param isolate Whether to directionally isolate the CharSequence to prevent it from garbling the content around it @return Input CharSequence after applying the above processing . null if str is null .
public CharSequence unicodeWrap(CharSequence str, TextDirectionHeuristicCompat heuristic,
            boolean isolate) {
        if (str == null) return null;
        final boolean isRtl = heuristic.isRtl(str, 0, str.length());
        SpannableStringBuilder result = new SpannableStringBuilder();
        if (getStereoReset() && isolate) {
            result.append(markBefore(str,
                    isRtl ? TextDirectionHeuristicsCompat.RTL : TextDirectionHeuristicsCompat.LTR));
        }
        if (isRtl != mIsRtlContext) {
            result.append(isRtl ? RLE : LRE);
            result.append(str);
            result.append(PDF);
        } else {
            result.append(str);
        }
        if (isolate) {
            result.append(markAfter(str,
                    isRtl ? TextDirectionHeuristicsCompat.RTL : TextDirectionHeuristicsCompat.LTR));
        }
        return result;
    }
public CharSequence unicodeWrap ( CharSequence str , TextDirectionHeuristicCompat heuristic , boolean isolate ) { if ( str == null ) return null ; final boolean isRtl = heuristic . isRtl ( str , 0 , str . length ( ) ) ; SpannableStringBuilder result = new SpannableStringBuilder ( ) ; if ( getStereoReset ( ) && isolate ) { result . append ( markBefore ( str , isRtl ? TextDirectionHeuristicsCompat . RTL : TextDirectionHeuristicsCompat . LTR ) ) ; } if ( isRtl != mIsRtlContext ) { result . append ( isRtl ? RLE : LRE ) ; result . append ( str ) ; result . append ( PDF ) ; } else { result . append ( str ) ; } if ( isolate ) { result . append ( markAfter ( str , isRtl ? TextDirectionHeuristicsCompat . RTL : TextDirectionHeuristicsCompat . LTR ) ) ; } return result ; }
Operates like {@link #unicodeWrap(String,
 androidx.core.text.TextDirectionHeuristicCompat, boolean)}, but takes a CharSequence
 instead of a string
Operates like { @link #unicodeWrap ( String androidx . core . text . TextDirectionHeuristicCompat boolean ) } but takes a CharSequence instead of a string