您将如何使用 Java 从邮政地址中清除街道号码? [英] How would you sanitize the street number out of a postal address using Java?

查看:105
本文介绍了您将如何使用 Java 从邮政地址中清除街道号码?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

为了确保数据隐私,我必须在删除街道号码后发布地址列表.

To ensure data privacy, I have to publish a list of addresses after removing the street numbers.

例如:

1600 Amphitheatre Parkway, Mountain View, CA

需要发布为

Amphitheatre Parkway, Mountain View, CA

在 Java 中执行此操作的最佳方法是什么?这需要正则表达式吗?

What's the best way to do this in Java? Does this require regex?

推荐答案

EDIT : How about...

EDIT : How about...

addressString.replace("^\\s*[0-9]+\\s+","");

或 JavaScript...

or JavaScript...

addressString.replace(/^\s*[0-9]+\s+/,'');

我最初的建议是 (JavaScript)...

My original suggestion was (JavaScript)...

addressString.replace(/^\s*[0-9]+\s*(?=.*$)/,'');

这篇关于您将如何使用 Java 从邮政地址中清除街道号码?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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