스페이스 바 등 몇몇 문자열 가능하게 처리 & 문자열 보정

This commit is contained in:
2018-06-24 04:44:34 +09:00
parent c4f5962c7e
commit b534da34ad
4 changed files with 37 additions and 23 deletions
+9 -4
View File
@@ -150,13 +150,18 @@ class StringUtil
return $str;
}
public static function textStrip(?string $str):string{
if(!$str){
return '';
}
return preg_replace('/^[\pZ\pC]+|[\pZ\pC]+$/u','',$str);
}
public static function removeSpecialCharacter($str)
{
return str_replace([
' ', '"', '\'', 'ⓝ', 'ⓜ', 'ⓖ', '\\', '/', '`',
'-', '=', '[', ']', ';', ',', '.', '~', '!', '@',
'#', '$', '%', '^', '&', '*', '(', ')', '_', '+',
'|', '{', '}', ':', '', '<', '>', '?', ' '
'"', '\'', 'ⓝ', 'ⓜ', 'ⓖ', '\\', '/', '`', '#',
'-', '#', '|'
], '', $str);
}