summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid A. Madore <david+git@madore.org>2010-04-29 03:29:40 +0200
committerDavid A. Madore <david+git@madore.org>2010-04-29 03:29:40 +0200
commit5faf5b459a06e9708707594d51974cc8d5a67c59 (patch)
tree58ef2189305702820c0e753e1145d90227a27a32
parent6b1b044c5e51218c03eeccf5dddb65b58e25d22f (diff)
downloadUnicodeMap-5faf5b459a06e9708707594d51974cc8d5a67c59.tar.gz
UnicodeMap-5faf5b459a06e9708707594d51974cc8d5a67c59.tar.bz2
UnicodeMap-5faf5b459a06e9708707594d51974cc8d5a67c59.zip
Make search a bit more friendly.
-rw-r--r--res/values/strings.xml5
-rw-r--r--src/org/madore/android/unicodeMap/UnicodeMapActivity.java3
2 files changed, 7 insertions, 1 deletions
diff --git a/res/values/strings.xml b/res/values/strings.xml
index acdc3e0..8c73c38 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -16,7 +16,10 @@
<string name="menu_search">Search</string>
<string name="search_title">Search in character names</string>
<string name="search_button">Search</string>
- <string name="search_hint">Case is insensitive and matches whole string; use a % sign as wildcard (e.g.: "latin%letter r%")</string>
+ <string name="search_hint">Case is insensitive and matches whole
+ string; use a * sign as wildcard (e.g.:
+ "latin*letter r*"); CJK ideographs and Hangul syllables cannot
+ be searched</string>
<string name="search_results">search results</string>
<string name="list_too_long">Only %d first results shown</string>
<string name="menu_about">About</string>
diff --git a/src/org/madore/android/unicodeMap/UnicodeMapActivity.java b/src/org/madore/android/unicodeMap/UnicodeMapActivity.java
index 2795c28..5a2622a 100644
--- a/src/org/madore/android/unicodeMap/UnicodeMapActivity.java
+++ b/src/org/madore/android/unicodeMap/UnicodeMapActivity.java
@@ -362,6 +362,9 @@ public final class UnicodeMapActivity extends ListActivity {
final static int searchLimit = 1000;
protected void doSearch(String s) {
+ s = s.replaceAll("\\*", "%");
+ s = s.replaceAll("^\\s*", "");
+ s = s.replaceAll("\\s*$", "");
Display newDisp = new SearchDisplay(getResources().getString(R.string.search_results),
s, searchLimit);
saveDisplay();