【问题标题】:How can I remove a part from an URL using Java如何使用 Java 从 URL 中删除一部分
【发布时间】:2020-01-11 21:50:52
【问题描述】:

我得到了什么:

116:part-of-the-url-for-deep-link

我需要什么:

part-of-the-url-for-deep-link 

(去掉数字和:)

谢谢!

【问题讨论】:

  • 仅作记录:Tool.MY_TOOL,这是一个枚举?

标签: java regex url


【解决方案1】:

您可以使用String::split

String got = "116:part-of-the-url-for-deep-link";
String want = got.split (":")[1];

【讨论】:

  • 当然,别忘了用 if ( got.split (":").length > 1 ) 进行保护
猜你喜欢
  • 2021-05-17
  • 1970-01-01
  • 2018-04-07
  • 2014-06-26
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2013-05-05
相关资源
最近更新 更多