Finds the next {@code '$'} in a class name which can be changed to a {@code '.'} when computing
a canonical class name.
1562
private static int nextDollar(String className, CharSequence current, int searchStart) {
    while (true) {
      int index = className.indexOf('$', searchStart);
      if (index == -1) {
        return -1;
      }
      // We'll never have two dots nor will a type name end or begin with dot. So no need to
      // consider dollars at the beginning, end, or adjacent to dots.
      if (index == 0 || index == className.length() - 1
          || current.charAt(index - 1) == '.' || current.charAt(index + 1) == '.') {
        searchStart = index + 1;
        continue;
      }
      return index;
    }
  }
973925
public static String getShortName(String className) {
        int i = className.lastIndexOf(".");
        if (i > -1) {
            className = className.substring(i + 1, className.length());
        }
        return className;
    }
720350
def unmangle_name(name, classname):
        
        if name.startswith(classname) and name[-2:] != '__':
            return name[len(classname) - 2:]
        return name
120714
public static String extractName(String className) {
	if (className == null) return null;
	int index = className.lastIndexOf('.');
	if (index != -1) return className.substring(index + 1);
	return className;
    }
1033585
public String reflectionName() {
    return enclosingClassName != null
        ? (enclosingClassName.reflectionName() + '$' + simpleName)
        : (packageName.isEmpty() ? simpleName : packageName + '.' + simpleName);
  }
1256992
private JType findType( Class<?> clazz ) {
        if ( clazz.isPrimitive() ) {

            return JPrimitiveType.parse( clazz.getCanonicalName() );

        } else if ( clazz.isArray() ) {

            try {
                return context.getTypeOracle().parse( clazz.getCanonicalName() );
            } catch ( TypeOracleException e ) {
                logger.log( TreeLogger.WARN, "Cannot find the array denoted by the class " + clazz.getCanonicalName() );
                return null;
            }

        } else {
            return findClassType( clazz );
        }
    }
995627
public static String getLoadableName( TypeDeclaration jclass )
    {
        TypeDeclaration containingClass = jclass.getDeclaringType();
        
        if ( containingClass == null )
        {
            return jclass.getQualifiedName();
        }
        else
        {
            return getLoadableName( containingClass ) + '$' + jclass.getSimpleName();
        }
    }
1368343
public static String getShortClassName( Class<?> clazz )
    {
        String className = clazz.getName();
        int idx = className.lastIndexOf('.');
        return (idx == -1 ? className : className.substring(idx+1));
    }
55250
public static String getFullClassName(String className) {
        final int i = className.indexOf('$');
        if (i > -1) {
            className = className.substring(0, i);
        }
        return className;
    }
890967
@Override
    public JavaClass findClass(/*@Nonnull*/ String className) {
        // Make sure we handle class names with slashes.
        // If we don't, we can get into serious trouble: a previously
        // loaded class will appear to be missing (because we're using the
        // wrong name to look it up) and be evicted by some other random
        // version of the class loaded from the classpath.
        String dottedClassName = className.replace('/', '.');

        return nameToClassMap.get(dottedClassName);
    }
483810
private static SubclassType typeofClassDefiningName(Node callName) {
    // Check if the method name matches one of the class-defining methods.
    String methodName = null;
    if (callName.isGetProp()) {
      methodName = callName.getLastChild().getString();
    } else if (callName.isName()) {
      String name = callName.getString();
      int dollarIndex = name.lastIndexOf('$');
      if (dollarIndex != -1) {
        methodName = name.substring(dollarIndex + 1);
      }
    }

    if (methodName != null) {
      if (methodName.equals("inherits")) {
        return SubclassType.INHERITS;
      } else if (methodName.equals("mixin")) {
        return SubclassType.MIXIN;
      }
    }
    return null;
  }
1168224
public static String getJustClassName(Class<?> cls)
   {
      if (cls == null)
         return null;
      if (cls.isArray())
      {
         Class<?> c = cls.getComponentType();
         return getJustClassName(c.getName());
      }

      return getJustClassName(cls.getName());
   }
1312544
private String getScalaClassName(PsiClass c) {
    String baseName = c.getName();
    return baseName.replaceAll("\\$", "");
  }
1305550
private static ImmutableList<String> getClassNames(String qualifiedName) {
    ImmutableList.Builder<String> classNames = ImmutableList.builder();
    List<String> parts = DOT_SPLITTER.splitToList(qualifiedName);
    for (int i = 0; i < parts.size(); i++) {
      String part = parts.get(i);
      if (isClassOrConstantName(part)) {
        classNames.add(DOT_JOINER.join(parts.subList(0, i + 1)));
      }
    }
    return classNames.build();
  }
510368
public static String getClassName(String key) {
    int start = 0;
    if (key.startsWith("@") || key.startsWith("members/")) {
      start = key.lastIndexOf('/') + 1;
    }
    return (key.indexOf('<', start) == -1 && key.indexOf('[', start) == -1)
        ? key.substring(start)
        : null;
  }
58408
String getClassName(Element e) {
        // e has to be a TypeElement
        TypeElement te = (TypeElement)e;
        String packageName = elementUtils.getPackageOf(te).getQualifiedName().toString();
        String className = te.getQualifiedName().toString();
        if (className.startsWith(packageName + ".")) {
            String classAndInners = className.substring(packageName.length() + 1);
            className = packageName + "." + classAndInners.replace('.', '$');
        }
        return className;
    }
938697
public static String getBaseName(String className) {
        int i = className.indexOf("$");
        if (i == -1)
            return className;

        return className.substring(i + 1);
    }