如何删除 ASCII 数字 13? [英] How do I remove ASCII number 13?

查看:23
本文介绍了如何删除 ASCII 数字 13?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直想知道为什么我不能替换一个未知的空白字符直到一个小时前我决定循环遍历它并使用 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?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆