String[] greetings = {"Hello1", "Hello2", "Hello3"};
String otherString = "green";
Map<String, String[]> valuesMap = new HashMap<String, String[]>();
valuesMap.put("greeting", greetings);
valuesMap.put("color", otherString );
String templateString = "Its ${color} around. ${greeting} StrSubstitutor APIs.";
StrSubstitutor sub = new StrSubstitutor(valuesMap);
String resolvedString = sub.replace(templateString);
我正在寻找类似于:
的输出Its green around. Hello1 StrSubstitutor APIs.
or Hello2 StrSubstitutor APIs
or Hello3 StrSubstitutor APIs.
任何建议都会有所帮助。