Created
September 21, 2017 14:58
-
-
Save ar-android/67bc185d4201e91e69120536f699bacc 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