Java 使用下标替换字符串中的多个问号占位符
///'public class Main {//n public static void main(String[] args) {//n String str = ///'Hello ?, my name is ?, I am ? years old.///';//n String[] replacements = {///'Alice///', ///'Bob///', ///'25///'} ;//n//n for (int i = 0; i < replacements.length; i++) {//n str = str.replaceFirst(///'//?///', replacements[i]);//n }//n//n System.out.println(str);//n }//n}///
原文地址: https://www.cveoy.top/t/topic/p3dQ 著作权归作者所有。请勿转载和采集!