optimize StringUtils's replaceParams method