I have a method that takes a user's input in this case "%YEAR%" and converts that input into the current year. The getCopyrightProperty method takes a property entered by the user and displays its output. Which works fine. But how would I take if the user input %YEAR% and display the actually year to it along with also displaying the user output.
private static final String COPYRIGHT_PROPERTY = "copyright-message";
private static final String SHOWYEAR = "" + Calendar.getInstance().get(Calendar.YEAR);
public String getCopyrightProperty(){
return (this.properties != null) ? this.properties.get(COPYRIGHT_PROPERTY, "") : null;
}
public String getSubstituteCurrYear(String in){
return in.replaceAll("%YEAR%", SHOWYEAR);
}
Sample input would be "%YEAR% input some placeholder text" and ideally the output should be "2013 input some placeholder text"
properties.get is a sling method that gathers user input from a specific property