1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
function format_excel_value($str){ $str = trim($str); if(substr($str, 0, 1) == '='){//"=" will cause formular error $str = substr($str, 1); } $str = preg_replace('/\\\"/', '"', $str); $str = preg_replace("/\\\'/", ''', $str); $str = preg_replace("/[\n\r]/", '', $str); //$str = preg_replace("/[\s\n\r\t\v\x]/", '', $str);//Thsi will remove all space $str = preg_replace("~\x{00a0}~siu", '', $str); //$str = preg_replace('n\/a', '', $str); return $str; } |
Reference: