为了账号安全,请及时绑定邮箱和手机立即绑定

如何在下面的场景中操作java中的字符串

如何在下面的场景中操作java中的字符串

侃侃无极 2021-12-30 20:43:39
"\r\n\r\n\r\n\r\nCovered. Coverage is limited to a one-time only 7095 for one outpatien" +"t in vitro fertilization procedure while you are an 7095 member.  If you receive" +" 7095s for in vitro fertilization services under an 7095 plan, you will not b" +"e eligible for in vitro fertilization 7095s under any other 7095 plan. In vit" +"ro fertilization services are not covered when a surrogate is used.  The in vitr" +"o procedures must be performed at a medical facility that conforms to the Americ" +"an College of Obstetricians and Gynecologists’ guidelines for in vitro fertiliza" +"tion clinics or to the American Society for Reproductive Medicine’s minimal stan" +"dards for programs of in vitro fertilization. \r\n\r\n\r\n\r\n\r\nIf you have a male partn" +"er, you must meet all of the following criteria:\r\n•   You and your male partner " +" have a five-year history of infertility or infertility is related to one or mor" +"e of the following medical conditions: \r\n–         Endometriosis; \r\n–         Ex" +我想用具有以下限制的空字符串替换上面字符串中的 /r/n 。1. 如果 /r/n 只存在一次,则不要替换它(例如:/r/n) 2. 如果多个 /r/n 则替换(例如:/r/n/r/n/r/n/r /n 然后用空字符串替换。示例字符串 "\r\n\r\n\r\n\r\nCovered。覆盖范围仅限于\r\n 一名门诊患者一次仅 7095\r\n\r\n\r\n" ;预期产出:覆盖。承保范围仅限于\r\n 一名门诊患者一次性仅 7095
查看完整描述

1 回答

?
森林海

TA贡献2011条经验 获得超2个赞

我会写这样的东西:

my_str = my_str.replaceAll("(\r\n){2,}", "");

希望有帮助。


查看完整回答
反对 回复 2021-12-30
  • 1 回答
  • 0 关注
  • 127 浏览

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信