Skip to content

Instantly share code, notes, and snippets.

Created March 23, 2017 10:10
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
Generates mail like:
public static String generateMail(String name, String surname) {
String[] searchList = {"ä", "ö", "ü", "ß"};
String[] replaceList = {"ae", "oe", "ue", "ss"};
String mailAddress = StringUtils.defaultIfBlank(StringUtils.lowerCase(name, Locale.GERMAN), "vorname") + "." + StringUtils.defaultIfBlank(StringUtils.lowerCase(surname, Locale.GERMAN), "nachname");
mailAddress = mailAddress.replace(" ", "-");
mailAddress = StringUtils.replaceEachRepeatedly(mailAddress, searchList, replaceList);
return StringUtils.stripAccents(mailAddress) + Constants.DEFAULT_MAIL_DOMAIN;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment