Remove any extraneous control characters from text fields.
@param s The string to have control characters removed
@param removeCR <CODE>true</CODE> if carriage returns should be removed
@return The given string with all control characters removed
321595
public static String removeControlCharacters(String s, boolean removeCR)
    {
        String ret = s;
        if(ret != null)
        {
            ret = ret.replaceAll("_x000D_","");
            if(removeCR)
                ret = ret.replaceAll("\r","");
        }
        return ret;
    }
1210551
public static String 
    trimRight( String string, char c ) 
    {
    	for( int i = string.length(); i > 0; --i ) 
    	{
    		char charAt = string.charAt( i - 1 );
            if( charAt != c 
    		 && charAt != ' ' 
    		 && charAt != '\t' 
    		 && charAt != '\n'
    		 && charAt != '\r' ) 
    		{    			
    			return i == string.length() ? string : 
    			                              string.substring( 0, i );
    		}
    	}
    	return "";
    }
652440
public String removeTail(String srcStr, int charCount) {
        return getLeftOf(srcStr, srcStr.length() - charCount);
    }
253963
private static String sanitizeText(String text) {
        if (text.indexOf('\r') >= 0) {
            text = CR.matcher(text).replaceAll("");
        }
        if (!text.isEmpty() && !text.endsWith("\n")) {
            text += "\n";
        }
        return text;
    }
49937
@Nonnull
  public EChange removeByName (final String sName)
  {
    final IJSDeclaration aDecl = m_aDecls.remove (sName);
    if (aDecl == null)
      return EChange.UNCHANGED;
    m_aObjs.remove (aDecl);
    return EChange.CHANGED;
  }
548063
public void removeCharCommand()
    {
        if (!isCharCommand())
            return;
        if (getValue() == null)
            return;
        if (getValue().length() < 2)
            return;
        if (getValue().length() == 2)
        {
            setValue(null);
            setUsed(true);
            return;
        }
        setValue("-" + getValue().substring(2));
    }
1255256
public static function removeInvisibleCharacters($str, $url_encoded = true)
    {
        $non_display_ables = array();

        // every control character except newline (dec 10)
        // carriage return (dec 13), and horizontal tab (dec 09)

        if ($url_encoded) {
            $non_display_ables[] = '/%0[0-8bcef]/';  // url encoded 00-08, 11, 12, 14, 15
            $non_display_ables[] = '/%1[0-9a-f]/';   // url encoded 16-31
        }

        $non_display_ables[] = '/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F]+/S';   // 00-08, 11, 12, 14-31, 127

        do {
            $str = preg_replace($non_display_ables, '', $str, -1, $count);
        } while ($count);

        return $str;
    }
667940
public static String removeChar(String s, char c)
  {
    int pos = s.indexOf(c);
    if (pos < 0) {
      return s;
    }
    StringBuilder sb = new StringBuilder(s.length() - 1);
    int prevPos = 0;
    do {
      sb.append(s, prevPos, pos);
      prevPos = pos + 1;
      pos = s.indexOf(c, pos + 1);
    } while (pos > 0);
    sb.append(s, prevPos, s.length());
    return sb.toString();
  }
916326
static @Nonnull String removeQuote( @Nonnull String str ) {
        if( str.length() > 1 ) {
            char ch = str.charAt( 0 );
            if( ch == '\'' || ch == '\"' ) {
                if( str.charAt( str.length() - 1 ) == ch ) {
                    return str.substring( 1, str.length() - 1 );
                }
            }
        }
        return str;
    }
769237
function cleanStr(s, rs){ //(s: string (string), rs: remove spaces (bool))
	if(s){
		s = s.replace(/"/g, '').trim();
		if(rs) s = s.replace(/ /g, '');
	}
	return s;
}
96258
public void remove(byte b, String s) {
		Collection c = getAsCollection(b);
		c.remove(s);
		set(b, c);
	}
411907
public static String stripTrailingSlash(String s) {
    return s == null ? null : CharMatcher.is('/').trimTrailingFrom(s);
  }
566334
private static final String trimFirstWord(String s) {
        s = s.trim();
        char[] chars = s.toCharArray();
        int firstSpace = -1;

        for (int i = 0; i < chars.length; i++) {
            char c = chars[i];
            if (Character.isWhitespace(c)) {
                firstSpace = i;
                break;
            }
        }

        if (firstSpace == -1) {
            return s;
        }

        s = s.substring(firstSpace).trim();
        s = capitalize(s);

        return s;
    }
652100
public static boolean endsWith(CharSequence s, char c) {
        int len = s.length();
        return len > 0 && s.charAt(len - 1) == c;
    }
20735
private boolean containsOnly(String s, char c) {
        for (char c2 : s.toCharArray()) {
            if (c != c2)
                return false;
        }

        return true;
    }
672798
@SafeVarargs
    public static char[] removeAll(final char[] a, final char... elements) {
        if (N.isNullOrEmpty(a)) {
            return N.EMPTY_CHAR_ARRAY;
        } else if (N.isNullOrEmpty(elements)) {
            return a.clone();
        } else if (elements.length == 1) {
            return removeAllOccurrences(a, elements[0]);
        }

        final CharList list = CharList.of(a.clone());
        list.removeAll(CharList.of(elements));
        return list.trimToSize().array();
    }
975826
public StringGrabber removeHeadConsecutiveChars(char charToRemove) {
		boolean loop = true;

		if (sb.length() > 0) {
			while (loop) {
				if (sb.charAt(0) == charToRemove) {
					removeHead(1);
				} else {
					loop = false;
				}
			}
		}
		return StringGrabber.this;
	}