A javascript, usefull for a string manipulation toolbox.
Puts the first character in uppercase, the others in lowercase. Example : Vincent instead of vincent.
This code is specific to Kettle (Input.getString) but can be used in Talend with little change.
//First letter in uppercase, others in lowercase
var c = Input.getString().substr(0,1);
if (parseInt(Input.getString().length)==1)
{
var cc = upper(c);
}
else
{
var cc = upper(c) + lower(Input.getString().slice(1));
}
1 comment:
Hi Vincent!
nice post.
I just finished writing a post that explains some alternatives and improvements in this matter:
http://rpbouman.blogspot.com/2009/11/pentaho-data-integration-javascript.html
kind regards,
Roland
Post a Comment