This library helps to catch simple email domain typos. Its intended to be used as a hint when a user have to enter an email address.
The library is written in Kotlin and is inspired by the algorithm described here: http://norvig.com/spell-correct.html (Warning, it's not the exact same algo).
If you want to use it in your Android project, your can add it as a library in your build.gradle file, don't forget to add the wordpress-mobile maven repository. For instance:
dependencies {
// use the latest version
compile 'org.wordpress:emailchecker2:+'
}
Sample usage in Java:
String emailToCheck = "[email protected]";
String suggestion = EmailCheckerKt.suggestDomainCorrection(emailToCheck);
if (suggestion.compareTo(email) != 0) {
Log.v("MYAPP", "did you mean: " + suggestion + " ?");
}
Sample usage in Kotlin:
val emailToCheck = "[email protected]";
val suggestion = suggestDomainCorrection(emailToCheck)
if (suggestion != emailToCheck) {
Log.v("MYAPP", "did you mean: " + suggestion + " ?");
}
|-- example # Example App
`-- emailchecker # EmailChecker Library
- Build:
$ ./gradlew build
- Publish to bintray:
$ ./gradlew build bintrayUpload -PbintrayUser=XXX -PbintrayKey=XXX -PdryRun=false
This library is dual licensed unded MIT and GPL v2.
- Initial release