Skip to content
This repository has been archived by the owner on Nov 25, 2019. It is now read-only.

Commit

Permalink
Strip leading whitespace before lookup
Browse files Browse the repository at this point in the history
  • Loading branch information
itkach committed Sep 11, 2011
1 parent 5d79aa7 commit fad8fd3
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/aarddict/android/LookupActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,8 @@ public void run() {
private void doLookup(CharSequence word) {
if (dictionaryService == null)
return;
if (word.toString().equals("")) {
word = trimLeft(word.toString());
if (word.equals("")) {
Log.d(TAG, "Nothing to look up");
updateWordListUI(empty);
return;
Expand Down Expand Up @@ -370,5 +371,9 @@ public void onClick(View v) {
}
});

}
}

static String trimLeft(String s) {
return s.replaceAll("^\\s+", "");
}
}

0 comments on commit fad8fd3

Please sign in to comment.