From 11d9ee742f8ff3fb31b0e3beb32ee4870c63d8e3 Mon Sep 17 00:00:00 2001 From: "Tadashi G. Takaoka" Date: Wed, 4 Apr 2012 14:30:42 +0900 Subject: Use keyboardSet extra value of subtype to specify layout type Change-Id: Ice1f345a08a8d760e3b847c885c4072e3e142c97 --- java/src/com/android/inputmethod/latin/StringUtils.java | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'java/src/com/android/inputmethod/latin/StringUtils.java') 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); + } } -- cgit v1.2.3-83-g751a