str_replace() function
function str_replace(search, replace, string) { while(string.indexOf(search) != -1) { var array = string.split(search); string = array.join(replace); } return string; } // Example var str = 'testing\r\nthis'; trace(str); var newString = str; newString = str_replace("\r", '', newString); newString = str_replace("\n", ' ', newString); trace(newString);