About the mailbox how to verify is not the real business mailbox (Java Kanji and English call)

Source: Internet
Author: User

The domain name of the enterprise mailbox is generally [email protected] Company domain name, or [email protected] Company domain name this form. Here I only list [email protected] Company domain name this form.

The company wants me to do a business mailbox fuzzy matching and verification, just received thought difficult. Results online, found similar API. Instant little case.

Introducing JAR Package: Pinyin4j-2.5.0.jar

The code is my own casually write, should also be able to optimize, with two cycles, because we man contains a lot of polyphone.

/**
* Single Man Check
* @param Chinese
* @return
*/
public static Boolean Checkspell (String chinese,string mailaccount) {
Boolean result = false;
try {
Set conversion format
Hanyupinyinoutputformat DefaultFormat = new Hanyupinyinoutputformat ();
Defaultformat.setcasetype (hanyupinyincasetype.lowercase); Setting case
Defaultformat.settonetype (Hanyupinyintonetype.without_tone); Set up a non-tonal representation
char[] arr = Chinese.tochararray ();
for (int j = 0; J < Arr.length; J + +) {
result = false;
Calling the Ruby API
string[] Pinyin = Pinyinhelper.tohanyupinyinstringarray (Arr[j], defaultformat);
for (int i = 0; i < pinyin.length; i++) {
Eligible to jump out of the loop directly
if (Mailaccount.startswith (Pinyin[i])) {
Mailaccount = mailaccount.substring (Mailaccount.indexof (Pinyin[i]) +pinyin[i].length ());
result = true;
Break
}
}
if (result = = True) {
Continue
}
return result;
}
} catch (Badhanyupinyinoutputformatcombination e) {
TODO auto-generated Catch block
E.printstacktrace ();
}
return result;
}

public static void Main (string[] args) {
Boolean result = Checkspell ("Changxing thin", "[email protected]");
SYSTEM.OUT.PRINTLN (result);
result = Checkspell ("Changxing thin", "[email protected]");
SYSTEM.OUT.PRINTLN (result);
result = Checkspell ("Changxing thin", "[email protected]");
SYSTEM.OUT.PRINTLN (result);
result = Checkspell ("Changxing thin", "[email protected]");
SYSTEM.OUT.PRINTLN (result);
result = Checkspell ("Changxing thin", "[email protected]");
}

Copyright, reproduced please specify the source.

About the mailbox how to verify is not the real business mailbox (Java Kanji and English call)

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.