Saturday, 14 November 2009

Cleaning strings

Hi all,

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);

var cc = upper(c) + lower(Input.getString().slice(1));

1 comment:

Roland Bouman said...

Hi Vincent!

nice post.

I just finished writing a post that explains some alternatives and improvements in this matter:

kind regards,