我想从一个长字符串中提取一个数字我的代码是:
private String[] icons;
private String[] pages;
icons=geticons.split(";");
pages=article.split(";");
int i=0;
for (String page:pages)
{
pages[i].replaceAll("(image)([0-9])", icons[$2]);
i++;
}
但图标[$2] 错误。如何解决它。
示例:图标元素:
{"yahoo.com/logo.jpg" , "yahoo.com/logo3.jpg", "yahoo.com/logo8.jpg"}
页面元素:
"hello how image0 ar you? where image3 are you? image8"
输出 :
"hello how yahoo.com/logo.jpg ar you? where yahoo.com/logo3.jpg are you? yahoo.com/logo8.jpg"