String data = "hello, \r\n world!\r\n"; data = data.replaceAll("\r|\n",""); for (int i=0; i