Convert Capital letters to Small letters except the first letter

neharao
Giga Contributor

Hi all,

I have a requirement where i get values from excel sheet and using transform map i have to load it in servicenow. Can anyone please let me know how to convert all the capitals coming to smaller case except the first letter along with spaces. Please find below the format:'

For example:

ABCD EFGH IJKL

I want the output to look like below:

Abcd Efgh Ijkl

Kindly suggest me on this.

Thanks,

Neha

1 ACCEPTED SOLUTION

reginabautista
Kilo Sage

Try this:



var str = 'this is a test';


var pieces = str.split(" ");


      for ( var i = 0; i < pieces.length; i++ )


      {


              var j = pieces[i].charAt(0).toUpperCase();


              pieces[i] = j + pieces[i].substr(1).toLowerCase();


      }




alert(pieces.join(" "));


View solution in original post

5 REPLIES 5

reginabautista
Kilo Sage

Cool, glad I could help