class SubRep {
public static void main(String[] args) {
System.out.println(getPropertyGetMethodName("name"));
}
/*public static String getPropertyGetMethodName(String property) {
return ("get".concat(property.substring(0,1).toUpperCase().concat(property.substring(1))));
}*/
/*public static String getPropertyGetMethodName(String property) {
return ("get".concat(property.replace('n','N')));
}*/
public static String getPropertyGetMethodName(String property) {
StringBuilder sb = new StringBuilder("get");
sb.append(property.toUpperCase().substring(0,1)).append(property.substring(1));
return sb.toString();
}
} |
|