我将如何用数组中的值替换字符串中的字符或字符串的所有实例?
例如
String testString = "The ? ? was ? his ?";
String[] values = new String[]{"brown", "dog", "eating", "food"};
String needle = "?";
String result = replaceNeedlesWithValues(testString,needle,values);
//result = "The brown dog was eating his food";
方法签名
public String replaceNeedlesWithValues(String subject, String needle, String[] values){
//code
return result;
}