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


"rnrnrnrnCovered. 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. rnrnrnrnrnIf you have a male partn" +
"er, you must meet all of the following criteria:rn•   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: rn–         Endometriosis; rn–         Ex" +
"posure in utero to diethylstilbestrol (DES); rn–         Blockage or surgical re" +
"moval of one or both fallopian tubes; or rn–         Abnormal male factors contr" +
"ibuting to the infertility.rn•   You and your male partner have been unable to a" +
"ttain a successful pregnancy through other covered infertility treatments.rnrnrn" +
"rnrnIf you do not have a male partner, you must meet the following criteria:rn• " +
"  You are not known to be otherwise infertile, andrn•   You have failed to achie" +
"ve pregnancy following three cycles of physician directed, appropriately timed i" +
"ntrauterine insemination.rnrnrnrnrnPlease note: These services must have precert" +
"ification.  See Chapter 5: Precertification.rnPlease note: Exclusions or limits " +
"that may relate to this 7095 are described in Chapter 6: Services Not Covered" +
" in the section labeled Fertility and Infertility.rnrnrnrn"

我想用有以下限制的空字符串替换上面字符串中的/r/n。1.如果/r/n只存在一次,则不要替换它(例如:/r/n(2.如果有多个/r/n(例如:/r/n/r/n/r/r/n,则替换为空字符串。

字符串示例"\r\n\r\n\r\n已投保。一名门诊患者的保险范围仅限于\r\n一次性7095\r\n\r\n\r\n";

预期产出:已涵盖。一个门诊的保险范围仅限于\r\n一次性7095

我会写这样的东西:

my_str = my_str.replaceAll("(rn){2,}", "");

希望能有所帮助。

相关内容

  • 没有找到相关文章

最新更新