-
-
Save virendersran01/4c8da8d6e3ceba03c3dfb2087a9da040 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Return user short name | |
* */ | |
public static String getShortName(String name) { | |
String[] strings = name.split(" ");//no i18n | |
String shortName; | |
if (strings.length == 1) { | |
shortName = strings[0].substring(0, 2); | |
} else { | |
shortName = strings[0].substring(0, 1) + strings[1].substring(0, 1); | |
} | |
return shortName.toUpperCase(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment