gpt4 book ai didi

java - replaceAll 不替换字符串

转载 作者:塔克拉玛干 更新时间:2023-11-02 20:19:53 26 4
gpt4 key购买 nike

<分区>

我希望用我的 StringBuffer 符号替换文本“REPLACEME”。当我打印符号时,它是一个有效的字符串。当我打印我的查询时,它仍然有文本 REPLACEME 而不是符号。为什么?

private String buildQuery(){
String query = "http://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20yahoo.finance.quotes%20where%20symbol%20in%20(REPLACEME)&format=json&env=store%3A%2F%2Fdatatables.org%2Falltableswithkeys&callback=";

deserializeQuotes();

StringBuffer symbols = new StringBuffer();
for(int i = 0; i < quotes.size();i++){
if(i == (quotes.size()-1))
symbols.append("%22" + quotes.get(i).getSymbol() + "%22%"); //end with a quote
else
symbols.append("%22" + quotes.get(i).getSymbol() + "%22%2C");
}

System.out.println("***SYMBOLS***" + symbols.toString());
query.replaceAll("REPLACEME", symbols.toString());

return query;
}

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