gpt4 book ai didi

Java替换字符串2

转载 作者:行者123 更新时间:2023-12-01 17:20:57 25 4
gpt4 key购买 nike

I am try to replace below String

#cit {font-size:16pt; color:navy; text-align:center; font-weight:bold;}

#cit {字体大小:16pt;红色;文本对齐:居中;字体粗细:粗体;}

我正在为此编写 Java 代码

strbuf.toString().replaceAll(Pattern.quote("#cit {font-size:16pt; color:navy;    
text-align:center; font-weight:bold;}"), "#cit {font-size:16pt; color:red;
text-align:center; font-weight:bold;}");

但是字符串没有被替换?请帮助我

最佳答案

改变

strbuf.toString().replaceAll(Pattern.quote("#cit {font-size:16pt; color:navy; text-align:center; font-weight:bold;}"), "#cit {font-size:16pt; color:red; text-align:center; font-weight:bold;}");

strbuf.toString().replaceAll("#cit {font-size:16pt; color:navy; text-align:center; font-weight:bold;}", "#cit {font-size:16pt; color:red; text-align:center; font-weight:bold;}");

关于Java替换字符串2,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18865315/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com