Java name parse library?

前端 未结 5 761
梦如初夏
梦如初夏 2021-01-07 20:58

I\'m searching for a library similar in functionality to the Perl Lingua::EN::NameParse module. Essentially, I\'d like to parse strings like \'Mr. Bob R. Smith\' into prefix

5条回答
  •  不思量自难忘°
    2021-01-07 21:28

    Apache Commons has the HumanNameParser class.

    https://commons.apache.org/sandbox/commons-text/jacoco/org.apache.commons.text.names/HumanNameParser.java.html

     Name nextName = parser.parse("James C. ('Jimmy') O'Dell, Jr.")
     String firstName = nextName.getFirstName();
     String nickname = nextName.getNickName();
    

提交回复
热议问题