问题描述
我一直想知道为什么我不能替换一个未知的空白字符直到一个小时前我决定循环遍历它并使用 php ord 函数我发现它实际上是字符 ASCII 数字 13.我尝试了以下操作删除它但没有用:
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)
有什么帮助吗?
推荐答案
十六进制的 13 是十进制的 19,这是 ASCII 控制字符 DC3
,不是正确的空格.
13 in hexadecimal is 19 in decimal, which is the ASCII control character DC3
, which isn't properly whitespace.
您可能指的是十进制 13,这是一个回车.在十六进制中,它是 D,因此您可以使用 \x0D
代替.
You probably mean decimal 13, which is a carriage return. In hexadecimal, that's D, so you'd use \x0D
instead.
这篇关于如何删除 ASCII 数字 13?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!