很长一段时间以来,我一直试图解决这个问题。
我想更改字符串中每个出现的 url,如下所示:
int i = 0
string.for each occurrence of ("/some static part/" + ${this could be anything}) {
replace with "/some other static part" + i + "/some other static part/"
i++
}
这是我能描述它的最好方式。
我不能使用 replaceAll,因为 url 的结尾部分确实发生了变化,并且将其更改为的 url 也发生了变化。
有任何想法吗?