static public String trim(String s, int bad) {
    int len = s.length();
    int st = 0;

    while ((st < len) && (s.charAt(st) == bad)) {
      st++;
    }
    while ((st < len) && (s.charAt(len - 1) == bad)) {
      len--;
    }
    return ((st > 0) || (len < s.length())) ? s.substring(st, len) : s;
  }
static public String trim(String s, int bad) {
    int len = s.length();
    int st = 0;

    while ((st < len) && (s.charAt(st) == bad)) {
      st++;
    }
    while ((st < len) && (s.charAt(len - 1) == bad)) {
      len--;
    }
    return ((st > 0) || (len < s.length())) ? s.substring(st, len) : s;
  }
static public String trim ( String s , int bad ) { int len = s . length ( ) ; int st = 0 ; while ( ( st < len ) && ( s . charAt ( st ) == bad ) ) { st ++ ; } while ( ( st < len ) && ( s . charAt ( len - 1 ) == bad ) ) { len -- ; } return ( ( st > 0 ) || ( len < s . length ( ) ) ) ? s . substring ( st , len ) : s ; }
Remove bad char from beginning or end of string

@param s operate on this
@return trimmed string
Remove bad char from beginning or end of string