Assuming they are strings, you can just use the standard string functions :

        #set( $name = ${field.Property} )
        #set( $field = ${name.substring(0,1).toUpperCase()}${{name.substring(1)} )


public String get${field}(){



Forgive line cropping etc.., you may have to wrap the whole lot in quotes.



DG


Qin Ding wrote:
I am new to Velocity. So, please forgive me for this simple question.

I have a list of field names in lower case.  I try to create a bean out of
the fieldList.  How do I make the First character of the field name
Uppercase ?

BEANS references the field list in VelocityContext. Something like id,
name, address, phoneNumber.

#foreach( $field in $BEANS )
  public String get${field.Property}(){
   return this.${field.Property};
  }
  public void set${field.Property}(String value){
    this.${field.Property} = value;
  }
#end

Above gives me
public String getname(){
  return this.name;
}

How do I get this:
public String getName(){
  return this.name;
}

Thank you.

Qin


----------------------------------------------------------------------------------------


This is a PRIVATE message. If you are not the intended recipient, please
delete without copying and kindly advise us by e-mail of the mistake in
delivery. NOTE: Regardless of content, this e-mail shall not operate to
bind CSC to any order or other contract unless pursuant to explicit written
agreement or government initiative expressly permitting the use of e-mail
for such purpose.
----------------------------------------------------------------------------------------





---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


-- Dr Daniel Graham Product Strategy Manager Video and Image Coding Specialists [EMAIL PROTECTED] http://www.videocoding.com Tel : [+44|0] 870 241 4618


--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to