Lines Matching defs:str

288      * given explicitly by a heuristic to estimate the {@code str}'s directionality.
290 * @param str String after which the mark may need to appear.
291 * @param heuristic The text direction heuristic that will be used to estimate the {@code str}'s
296 private String markAfter(String str, TextDirectionHeuristicCompat heuristic) {
297 final boolean isRtl = heuristic.isRtl(str, 0, str.length());
299 if (!mIsRtlContext && (isRtl || getExitDir(str) == DIR_RTL)) {
302 if (mIsRtlContext && (!isRtl || getExitDir(str) == DIR_LTR)) {
315 * directionality is given explicitly by a heuristic to estimate the {@code str}'s directionality.
317 * @param str String before which the mark may need to appear.
318 * @param heuristic The text direction heuristic that will be used to estimate the {@code str}'s
323 private String markBefore(String str, TextDirectionHeuristicCompat heuristic) {
324 final boolean isRtl = heuristic.isRtl(str, 0, str.length());
326 if (!mIsRtlContext && (isRtl || getEntryDir(str) == DIR_RTL)) {
329 if (mIsRtlContext && (!isRtl || getEntryDir(str) == DIR_LTR)) {
338 * @param str String whose directionality is to be estimated.
339 * @return true if {@code str}'s estimated overall directionality is RTL. Otherwise returns
342 public boolean isRtl(String str) {
343 return mDefaultTextDirectionHeuristicCompat.isRtl(str, 0, str.length());
352 * the string with Unicode bidi formatting characters: RLE+{@code str}+PDF for RTL text, or
353 * LRE+{@code str}+PDF for LTR text.
368 * @param str The input string.
372 * @return Input string after applying the above processing. {@code null} if {@code str} is
375 public String unicodeWrap(String str, TextDirectionHeuristicCompat heuristic, boolean isolate) {
376 if (str == null) return null;
377 final boolean isRtl = heuristic.isRtl(str, 0, str.length());
380 result.append(markBefore(str,
385 result.append(str);
388 result.append(str);
391 result.append(markAfter(str,
401 * @param str The input string.
405 public String unicodeWrap(String str, TextDirectionHeuristicCompat heuristic) {
406 return unicodeWrap(str, heuristic, true /* isolate */);
413 * @param str The input string.
418 public String unicodeWrap(String str, boolean isolate) {
419 return unicodeWrap(str, mDefaultTextDirectionHeuristicCompat, isolate);
426 * @param str The input string.
429 public String unicodeWrap(String str) {
430 return unicodeWrap(str, mDefaultTextDirectionHeuristicCompat, true /* isolate */);
462 * @param str the string to check.
464 private static int getExitDir(String str) {
465 return new DirectionalityEstimator(str, false /* isHtml */).getExitDir();
479 * @param str the string to check.
481 private static int getEntryDir(String str) {
482 return new DirectionalityEstimator(str, false /* isHtml */).getEntryDir();