Java Utililty Methods Class Simple Name Get

List of utility methods to do Class Simple Name Get

Description

The list of methods to do Class Simple Name Get are organized into topic(s).

Method

StringtoSimpleName(Class type)
to Simple Name
String name = type.getName().substring(type.getName().lastIndexOf(".") + 1);
return name.replaceAll("\\$", "_");
StringtoSimpleName(final String qualifiedName)
to Simple Name
final String[] tokens = qualifiedName.split("\\.");
return tokens[tokens.length - 1];
StringtoSimpleName(String className)
to Simple Name
if (className == null) {
    return null;
if (className.startsWith("$$")) {
    className = className.substring("$$".length());
int indexOfDollarDollar = className.indexOf("$$", 1);
if (indexOfDollarDollar < 0) {
...
StringtoSimpleName(String classPackageName)
to Simple Name
int lastIndexOf = classPackageName.lastIndexOf('.');
if (lastIndexOf >= 0)
    return classPackageName.substring(lastIndexOf + 1);
return "";
StringtoSimpleName(String fqn)
to Simple Name
int lastSeparatorPos = fqn.lastIndexOf(FQN_SEPARATOR);
if (lastSeparatorPos == -1)
    return fqn;
else
    return fqn.substring(lastSeparatorPos + 1);
StringtoSimpleName(String qname)
to Simple Name
int s = qname.lastIndexOf('.');
return (s == -1) ? qname : qname.substring(s + 1);
StringToSimpleName(String str)
To Simple Name
String[] strs = str.split("_");
String simpleName = strs[0];
if (strs.length > 1) {
    simpleName = str.replaceFirst(strs[0] + "_", "");
return simpleName;