How do I remove ASCII number 13?

2020-05-02 03:17发布

I have always wondered why I can't replace an unknown whitespace character until just an hour ago that I decided to loop through it and using php ord function I found out that it is actually character ASCII number 13. I tried the following to remove it but didn't work:

preg_replace('/\x13/','',$string)

any help?

1条回答
Deceive 欺骗
2楼-- · 2020-05-02 03:45

13 in hexadecimal is 19 in decimal, which is the ASCII control character DC3, which isn't properly whitespace.

You probably mean decimal 13, which is a carriage return. In hexadecimal, that's D, so you'd use \x0D instead.

查看更多
登录 后发表回答