diff options
author | Daniel Lehmann <lehmannd@google.com> | 2010-08-18 15:41:33 -0700 |
---|---|---|
committer | Daniel Lehmann <lehmannd@google.com> | 2010-08-18 15:41:33 -0700 |
commit | 167db392530067341c19b420050aa8a21b7f2616 (patch) | |
tree | 5d6c5218104ede99dda3a5f9dc041cb832f20eec /android | |
parent | e402679d640df63f301e5a42ce847764608a8b1d (diff) |
Put digits into an own segment with the title #
Change-Id: I5f3ae179d388c417abd512974df22fd78a699354
Diffstat (limited to 'android')
-rw-r--r-- | android/PhonebookIndex.cpp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/android/PhonebookIndex.cpp b/android/PhonebookIndex.cpp index 57f3bda..8f5e4be 100644 --- a/android/PhonebookIndex.cpp +++ b/android/PhonebookIndex.cpp @@ -143,8 +143,15 @@ int32_t GetPhonebookIndex(UCharIterator * iter, const char * locale, UChar * out UChar c = out[0]; - // We are only interested in letters if (!u_isalpha(c)) { + // Digits go into a # section. Everything else goes into the empty section + // The unicode function u_isdigit would also identify other characters as digits (arabic), + // but if we caught them here we'd risk having the same section before and after alpha-letters + // which might break the assumption that each section exists only once + if (c >= '0' && c <= '9') { + out[0] = '#'; + return 1; + } return 0; } |