"Shellifies" a name (that is, makes the name shell-friendly) by replacing spaces with "-" and removing colons

@param name
@return
176325
private static String shellifyName(String name)
   {
      String newName = WHITESPACES.matcher(name.trim()).replaceAll("-");
      // /FORGE-2690: Special case when command name ends with -
      if (newName.endsWith("-"))
      {
         newName = newName.substring(0, newName.length() - 1);
      }
      return COLONS.matcher(newName).replaceAll("");
   }
1093523
protected static String qualifiedNameFromIdAndContext(String name, String context) {
        if (!name.contains(".")) {
            return context + "." + name;
        }
        return name;
    }
727959
public static String toFileName(String name) {
		char[] charArray = name.toCharArray();
		StringBuilder builder = new StringBuilder();
		for (int i = 0; i < charArray.length; i++) {
			if (Character.isUpperCase(charArray[i]) && i > 0 && !Character.isUpperCase(charArray[i - 1])) {
				builder.append('.');
			}
			builder.append(Character.toLowerCase(charArray[i]));
		}
		return builder.toString();
	}
676821
protected String processFileName(String name) {

        int pos = name.lastIndexOf("/");
        if (pos >= 0) {
            name = name.substring(pos + 1);
        }
        pos = name.lastIndexOf("\\");
        if (pos >= 0) {
            name = name.substring(pos + 1);
        }
        return name;
    }
212352
@Ensures("result == isQualifiedName(name.replace('/', '.'))")
  public static boolean isBinaryName(String name) {
    if (name == null || name.isEmpty()) {
      return false;
    }
    String[] parts = name.split("/");
    for (String part : parts) {
      if (!isSimpleName(part)) {
        return false;
      }
    }
    return true;
  }
348913
private SemanticSpace getSSpace(String name) {
        String aliased = aliasToFileName.get(name);
        return (aliased != null) 
            ? fileNameToSSpace.get(aliased)
            : fileNameToSSpace.get(name);
    }
783965
public static String classNameToSignature(String name) {
        int nameLength = name.length();
        int colonPos = 1 + nameLength;
        char[] buf = new char[colonPos + 1];
        buf[0] = 'L';
        buf[colonPos] = ';';
        name.getChars(0, nameLength, buf, 1);
        for (int i = 1; i != colonPos; ++i) {
            if (buf[i] == '.') {
                buf[i] = '/';
            }
        }
        return new String(buf, 0, colonPos + 1);
    }
1124834
static String normalize(@NonNull String name) {
      StringBuilder toReturn = new StringBuilder();
      boolean previousSpace = false;
      for( char c : name.toCharArray()){
         if( Character.isWhitespace(c) ){
            if( !previousSpace ){
               toReturn.append('_');
            }
            previousSpace = true;
         } else {
            previousSpace = false;
            toReturn.append(Character.toUpperCase(c));
         }
      }
      return toReturn.toString();//name.toUpperCase().replaceAll("\\s+", "_");
   }
56507
public static CorpusFormat forName(@NonNull String name) {
      String format = StringUtils.trim(name).toUpperCase();
      boolean isOPL = format.endsWith("_OPL");
      final String normFormat = format.replaceAll("_OPL$", "").trim();
      if (formats.containsKey(normFormat)) {
         return isOPL ? new OnePerLineFormat(formats.get(normFormat)) : formats.get(normFormat);
      }
      throw new IllegalArgumentException(name + " is an unknown format.");
   }
411119
public Name name(String name) {
    switch (name) {
      case "":
        return Name.EMPTY;
      case ".":
        return Name.SELF;
      case "..":
        return Name.PARENT;
      default:
        String display = PathNormalization.normalize(name, displayNormalizations);
        String canonical = PathNormalization.normalize(name, canonicalNormalizations);
        return Name.create(display, canonical);
    }
  }
470077
public static String sanitizeDirectory(String name) {
        if (isBlank(name)) {
            return name;
        }
        return sanitize(name).replace(".", "");
    }
878567
private static String reduce(final String name) {
		int index = name.lastIndexOf('.');
		return index == -1 ? null : name.substring(0, index);
	}
79555
public static String quoteNameIfNecessary(String name) {
        int len = name.length();

        for (int i = 0; i < len; i++) {
            char c = name.charAt(i);

            if (! ((c >= 'A' && c <= 'Z') ||
                   (c >= 'a' && c <= 'z') ||
                   (c == ' ') ||
                   (c >= '0' && c <= '9'))) {
                return '"' + quoteName(name) + '"';
            }
        }

        return name;
    }
823225
public static String toUnderscore(String name) {
		return CaseFormat.LOWER_CAMEL.to(CaseFormat.LOWER_UNDERSCORE, name);
	}
1201131
private String toJavaName(String name) {
        StringBuilder stb = new StringBuilder();
        char[] namechars = name.toCharArray();
        if (!Character.isJavaIdentifierStart(namechars[0])) {
            stb.append("__");
        } else {
            stb.append(namechars[0]);
        }
        for (int i = 1; i < namechars.length; i++) {
            if (!Character.isJavaIdentifierPart(namechars[i])) {
                stb.append("__");
            } else {
                stb.append(namechars[i]);
            }
        }

        return stb.toString();
    }
1135126
public static String escapeName(String name) {
        if (StringUtils.isBlank(name)) {
            throw new IllegalArgumentException("Blank or null is not a valid name.");
        } else if (java.util.regex.Pattern.matches(NAME, name)) {
            return name;
        } else {
            return name.replaceAll("[^A-Za-z0-9\\.\\-_]", "-");
        }
    }
208122
public static boolean isValidName( String name ) {
        if (name == null || name.length() == 0) return false;
        CharacterIterator iter = new StringCharacterIterator(name);
        char c = iter.first();
        if (!isValidNameStart(c)) return false;
        while (c != CharacterIterator.DONE) {
            if (!isValidName(c)) return false;
            c = iter.next();
        }
        return true;
    }