+ 1

How to change the case of a single letter in a string ?

I have been given 2 strings as "hello" and "world". The output string required is "Hello World". How do i change the case of the first letter ?

31st Jul 2017, 8:56 PM
Prateek Kesharwani
Prateek Kesharwani - avatar
1 Respuesta
+ 1
Hi Prateek. varName = varName.toLowerCase() varName = varName.substring(0, 1).toUpperCase() + varName.substring(1).toLowerCase() // do this for each variable
31st Jul 2017, 9:25 PM
James Cooke