@ Nullable public static String stripBidi ( @ Nullable final String sStr ) { if ( sStr == null || sStr . length ( ) <= 1 ) return sStr ; String ret = sStr ; if ( isBidi ( ret . charAt ( 0 ) ) ) ret = ret . substring ( 1 ) ; if ( isBidi ( ret . charAt ( ret . length ( ) - 1 ) ) ) ret = ret . substring ( 0 , ret . length ( ) - 1 ) ; return ret ; }
Removes leading and trailing bidi controls from the string