private String stripOffCR(String str){
  String[] arr=str.split("\n");
  StringBuilder buf=new StringBuilder();
  for (  String s : arr) {
    if (s.endsWith("\r")) {
      buf.append(s.substring(0,s.length() - 1));
    }
 else {
      buf.append(s);
    }
    buf.append("\n");
  }
  return buf.toString();
}

private String stripOffCR ( String str ) { String [ ] arr = str . split ( "\n" ) ; StringBuilder buf = new StringBuilder ( ) ; for ( String s : arr ) { if ( s . endsWith ( "\r" ) ) { buf . append ( s . substring ( 0 , s . length ( ) - 1 ) ) ; } else { buf . append ( s ) ; } buf . append ( "\n" ) ; } return buf . toString ( ) ; }
removes ' \ r ' from the end of every line .
