public static String removeNewLineChars(String s){
  String retString=null;
  if ((s != null) && (s.length() > 0) && (s.indexOf('\n') != -1)) {
    char[] chars=s.toCharArray();
    int len=chars.length;
    StringBuffer sb=new StringBuffer(len);
    for (int i=0; i < len; i++) {
      char c=chars[i];
      if (c != '\n') {
        sb.append(c);
      }
    }
    retString=sb.toString();
  }
 else {
    retString=s;
  }
  return retString;
}

public static String removeNewLineChars ( String s ) { String retString = null ; if ( ( s != null ) && ( s . length ( ) > 0 ) && ( s . indexOf ( '\n' ) != - 1 ) ) { char [ ] chars = s . toCharArray ( ) ; int len = chars . length ; StringBuffer sb = new StringBuffer ( len ) ; for ( int i = 0 ; i < len ; i ++ ) { char c = chars [ i ] ; if ( c != '\n' ) { sb . append ( c ) ; } } retString = sb . toString ( ) ; } else { retString = s ; } return retString ; }
removes new line characters ( useful for base64 decoding )
