aboutsummaryrefslogtreecommitdiffstats
path: root/java/src/com/android/inputmethod/latin/StringUtils.java
diff options
context:
space:
mode:
authorTadashi G. Takaoka <takaoka@google.com>2012-04-05 19:17:30 -0700
committerAndroid (Google) Code Review <android-gerrit@google.com>2012-04-05 19:17:30 -0700
commitfc169c726a12f47c3641fc2570d16aa26825710c (patch)
tree0bb14631cb79c283adbc99991432d990bddbf842 /java/src/com/android/inputmethod/latin/StringUtils.java
parent0cedde120b02629ab86efd1ef015ad1ee2d8783a (diff)
parent11d9ee742f8ff3fb31b0e3beb32ee4870c63d8e3 (diff)
downloadlatinime-fc169c726a12f47c3641fc2570d16aa26825710c.tar.gz
latinime-fc169c726a12f47c3641fc2570d16aa26825710c.tar.xz
latinime-fc169c726a12f47c3641fc2570d16aa26825710c.zip
Merge "Use keyboardSet extra value of subtype to specify layout type"
Diffstat (limited to 'java/src/com/android/inputmethod/latin/StringUtils.java')
-rw-r--r--java/src/com/android/inputmethod/latin/StringUtils.java17
1 files changed, 17 insertions, 0 deletions
diff --git a/java/src/com/android/inputmethod/latin/StringUtils.java b/java/src/com/android/inputmethod/latin/StringUtils.java
index 7000e4633..42fce53d0 100644
--- a/java/src/com/android/inputmethod/latin/StringUtils.java
+++ b/java/src/com/android/inputmethod/latin/StringUtils.java
@@ -22,6 +22,7 @@ import android.view.inputmethod.EditorInfo;
import com.android.inputmethod.keyboard.Keyboard;
import java.util.ArrayList;
+import java.util.Locale;
public class StringUtils {
private StringUtils() {
@@ -149,4 +150,20 @@ public class StringUtils {
i++;
}
}
+
+ public static String toTitleCase(String s, Locale locale) {
+ if (s.length() <= 1) {
+ // TODO: is this really correct? Shouldn't this be s.toUpperCase()?
+ return s;
+ }
+ // TODO: fix the bugs below
+ // - This does not work for Greek, because it returns upper case instead of title case.
+ // - It does not work for Serbian, because it fails to account for the "lj" character,
+ // which should be "Lj" in title case and "LJ" in upper case.
+ // - It does not work for Dutch, because it fails to account for the "ij" digraph, which
+ // are two different characters but both should be capitalized as "IJ" as if they were
+ // a single letter.
+ // - It also does not work with unicode surrogate code points.
+ return s.toUpperCase(locale).charAt(0) + s.substring(1);
+ }
}