我想通过用“ *”替换单词中的每个字符来检查字符串中的某些单词。基本上我想做
String s = "lorem ipsum dolor sit";
s = s.replaceAll("ipsum|sit", $0.length() number of *));
Run Code Online (Sandbox Code Playgroud)
这样结果s等于"lorem ***** dolor ***"。
我知道如何通过重复replaceAll发票来做到这一点,但是我想知道,是否可以通过单个发票来做到这一点?replaceAll
更新:这是研究案例研究的一部分,其原因基本上是我想摆脱单一代码,因为它简化了生成的字节码。这不是一个严肃的网页或任何东西。