Browse Source

暂存一下工具类

persist/11.0-arabic
obo 4 months ago
parent
commit
f5092d0df5
  1. 18
      designer-base/src/main/java/com/fr/base/i18n/BidiUtils.java

18
designer-base/src/main/java/com/fr/base/i18n/BidiUtils.java

@ -13,8 +13,8 @@ import java.util.Locale;
*/
public class BidiUtils {
private static final Locale ar = new Locale("ar", "SA");
private static final Locale cn = Locale.CHINA;
//private static final Locale ar = new Locale("ar", "SA");
private static final Locale ar = Locale.CHINA;
private BidiUtils() {
}
@ -42,4 +42,18 @@ public class BidiUtils {
public static boolean rtl() {
return ComponentOrientation.getOrientation(ar) == ComponentOrientation.RIGHT_TO_LEFT;
}
public static String reverseConcatenateStrings(String... strs) {
StringBuilder result = new StringBuilder();
if (rtl()) {
for (int i = strs.length - 1; i >= 0; i--) {
result.append(strs[i]);
}
} else {
for (int i = 0; i <= strs.length - 1; i++) {
result.append(strs[i]);
}
}
return result.toString();
}
}

Loading…
Cancel
Save