mirror of
https://github.com/zxing/zxing.git
synced 2025-03-05 20:48:51 -08:00
Tighten email check logic a little
git-svn-id: https://zxing.googlecode.com/svn/trunk@857 59b500cc-1b3d-0410-9834-0bbf25fbcc57
This commit is contained in:
parent
8e18d651bb
commit
dd1eccfda8
|
@ -55,8 +55,20 @@ final class EmailDoCoMoResultParser extends AbstractDoCoMoResultParser {
|
|||
if (email == null) {
|
||||
return false;
|
||||
}
|
||||
int atIndex = email.indexOf('@');
|
||||
return atIndex >= 0 && email.indexOf('.') > atIndex && email.indexOf(' ') < 0;
|
||||
boolean atFound = false;
|
||||
for (int i = 0; i < email.length(); i++) {
|
||||
char c = email.charAt(i);
|
||||
if (c == '@') {
|
||||
atFound = true;
|
||||
} else if (c == '.') {
|
||||
if (!atFound) {
|
||||
return false;
|
||||
}
|
||||
} else if (c == ' ' || c == '\n') {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in a new issue