13,313
edits
(2 intermediate revisions by the same user not shown) | |||
Line 459: | Line 459: | ||
</pre> | </pre> | ||
=== | === Remove other string look like whitespace === | ||
[https://en.wikipedia.org/wiki/Whitespace_character Whitespace character] | [https://en.wikipedia.org/wiki/Whitespace_character Whitespace character] | ||
# [http://www.fileformat.info/info/unicode/char/3000/index.htm IDEOGRAPHIC SPACE] (全形空白、全型空白, U+3000)<ref>[https://www.ptt.cc/bbs/PHP/M.1473522044.A.4FC.html Re: 請益 mysql空百=? - 看板 PHP - 批踢踢實業坊]</ref>: | # [http://www.fileformat.info/info/unicode/char/3000/index.htm IDEOGRAPHIC SPACE] (全形空白、全型空白, U+3000)<ref>[https://www.ptt.cc/bbs/PHP/M.1473522044.A.4FC.html Re: 請益 mysql空百=? - 看板 PHP - 批踢踢實業坊]</ref>: | ||
#* diaplay: <pre><nowiki><?php $string = "111" . json_decode('"\u3000"') . "222"; echo $string;?></nowiki></pre> | #* diaplay: <pre><nowiki><?php $string = "111" . json_decode('"\u3000"') . "222"; echo $string;?></nowiki></pre> | ||
#* replace with space: <pre><nowiki><?php echo str_replace(json_decode('"\u3000"'), " ", $string);?></nowiki></pre> | #* replace with space: <pre><nowiki><?php echo str_replace(json_decode('"\u3000"'), " ", $string);?></nowiki></pre> | ||
# ASCII Vertical Tab \v | # ASCII Vertical Tab {{kbd | key=<nowiki>\v</nowiki>}} | ||
# ASCII Horizontal Tab (TAB) \t | # ASCII Horizontal Tab (TAB) {{kbd | key=<nowiki>\t</nowiki>}} | ||
# ASCII Backspace \b | # ASCII Backspace {{kbd | key=<nowiki>\b</nowiki>}} | ||
# [https://en.wikipedia.org/wiki/Non-breaking_space Non-breaking space] ({{kbd | key=<nowiki>nbsp;</nowiki>}}) Replace Non-breaking space with one whitespace using PHP: {{kbd | key=<nowiki>$result = str_replace("\xc2\xa0", ' ', $original_string);</nowiki>}}<ref>[https://stackoverflow.com/questions/40724543/how-to-replace-decoded-non-breakable-space-nbsp php - How to replace decoded Non-breakable space (nbsp) - Stack Overflow]</ref> | |||
== Further reading == | == Further reading == |