summaryrefslogtreecommitdiffstats
path: root/core/java/android/text/TextUtils.java
diff options
context:
space:
mode:
authorDaisuke Miyakawa <dmiyakawa@google.com>2009-12-03 10:43:45 +0900
committerDaisuke Miyakawa <dmiyakawa@google.com>2009-12-03 15:45:19 +0900
commit973afa96bf184be6b8b5a25963568650e70750f7 (patch)
treec4965d8c28cd1b37f0b03ef8dc3ea9f972988a22 /core/java/android/text/TextUtils.java
parenta45e925108f6c9d35d9e7b5e8def9aba49ee0dba (diff)
downloadframeworks_base-973afa96bf184be6b8b5a25963568650e70750f7.zip
frameworks_base-973afa96bf184be6b8b5a25963568650e70750f7.tar.gz
frameworks_base-973afa96bf184be6b8b5a25963568650e70750f7.tar.bz2
Add isPrintableAscii() and isPrintableAsciiOnly() to TextUtils.java as hidden methods, and make vCard code use them.
In the future, ContactsProvider will use those methods. See also the change 34604 Internal issue number: 2275764, 2195990
Diffstat (limited to 'core/java/android/text/TextUtils.java')
-rw-r--r--core/java/android/text/TextUtils.java22
1 files changed, 22 insertions, 0 deletions
diff --git a/core/java/android/text/TextUtils.java b/core/java/android/text/TextUtils.java
index 53096dd..afb22ac 100644
--- a/core/java/android/text/TextUtils.java
+++ b/core/java/android/text/TextUtils.java
@@ -1501,6 +1501,28 @@ public class TextUtils {
}
/**
+ * @hide
+ */
+ public static boolean isPrintableAscii(final char c) {
+ final int asciiFirst = 0x20;
+ final int asciiLast = 0x7E; // included
+ return (asciiFirst <= c && c <= asciiLast) || c == '\r' || c == '\n';
+ }
+
+ /**
+ * @hide
+ */
+ public static boolean isPrintableAsciiOnly(final CharSequence str) {
+ final int len = str.length();
+ for (int i = 0; i < len; i++) {
+ if (!isPrintableAscii(str.charAt(i))) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ /**
* Capitalization mode for {@link #getCapsMode}: capitalize all
* characters. This value is explicitly defined to be the same as
* {@link InputType#TYPE_TEXT_FLAG_CAP_CHARACTERS}.