List of utility methods to do String Sanitize
String | sanitizeMimeType(final String mimeType) Mimetypes can be a tricky thing as browsers and/or environments tend to alter them without good reason. if (MIME_TYPE_PJPEG.equalsIgnoreCase(mimeType)) { return MIME_TYPE_JPEG; if (MIME_TYPE_CITRIX_JPEG.equalsIgnoreCase(mimeType)) { return MIME_TYPE_JPEG; } else if (MIME_TYPE_CITRIX_GIF.equalsIgnoreCase(mimeType)) { return MIME_TYPE_GIF; if (MIME_TYPE_X_PNG.equalsIgnoreCase(mimeType)) { return MIME_TYPE_PNG; return mimeType.toLowerCase(); |
String | sanitizeName(String input) sanitize Name return blankIfNull(input).replaceAll("[^A-Za-z0-9]", ""); |
String | SanitizeName(String Name) Takes a string and rewrites it by replacing all special characters with an '_'. char C[] = Name.toCharArray(); for (int i = 0; i < C.length; ++i) { switch (C[i]) { case ' ': case '*': case '\'': case '/': case '"': ... |
String | sanitizeName(String name) Returns an identifier from the given string that can be used as resource name. if (name != null) { return name.replaceAll("[^A-Za-z0-9]+", "-"); return null; |
String | sanitizeName(String name) Sanitize a String so that it can be used as a Java identifier. char[] nameArray = name.toCharArray(); for (int i = 0; i < nameArray.length; i++) { if (!Character.isJavaIdentifierPart(nameArray[i])) { nameArray[i] = '_'; if (nameArray.length == 0) { return ""; ... |
String | sanitizeName(String name) sanitize Name return name != null ? (name.contains(" ") ? name.toLowerCase().replaceAll(" ", "_") : name.toLowerCase()) : null; |
String | sanitizeName(String origName) Produce a sanitized name that fits our standards for likely to work. char c[] = origName.toCharArray(); StringBuffer buffer = new StringBuffer(); if ((c[0] >= '0') && (c[0] <= '9')) { buffer.append('_'); for (int i = 0; i < c.length; i++) { if (((c[i] >= '0') && (c[i] <= '9')) || ((c[i] >= 'a') && (c[i] <= 'z')) || ((c[i] >= 'A') && (c[i] <= 'Z'))) { ... |
String | sanitizeNamespace(String namespace) sanitize Namespace return namespace.replaceAll("(http://)|(/$)", "").replaceAll("[./-]", "_"); |
String | sanitizeOperationId(String operationId) sanitize Operation Id StringBuffer result = new StringBuffer(); for (int i = 0; i < operationId.length(); i++) { char c = operationId.charAt(i); if (c == '-' || c == ' ' || c == '_') { try { while (c == '-' || c == ' ' || c == '_') { i++; c = operationId.charAt(i); ... |
String | sanitizePackageName(String raw) Convert a raw package name to a legal Java package name. StringBuffer buff = new StringBuffer(raw.length()); boolean first = true; for (int i = 0; i < raw.length();) { char chr = buff.charAt(i); if (first) { if (Character.isJavaIdentifierStart(chr)) { first = false; i++; ... |