从字符串的开头删除数字然后一个空格 [英] Remove number then a space from the start of a string

查看:35
本文介绍了从字符串的开头删除数字然后一个空格的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何从字符串的开头删除数字和空格?

How would I go about removing numbers and a space from the start of a string?

例如,从13 Adam Court, Cannock"中删除13"

For example, from '13 Adam Court, Cannock' remove '13 '

推荐答案

使用我在 JavaScript 答案,但使用 preg_replace() 应用它:

Use the same regex I gave in my JavaScript answer, but apply it using preg_replace():

preg_replace('/^\d+\s+/', '', $str);

这篇关于从字符串的开头删除数字然后一个空格的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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