capitalize() is a predefined method to make first letter of a word capital.
For example:-
String name = ‘chauhan’;
System.debug(‘Capitalize-‘ + name.capitalize());
Hi Anjali,
capitalize() method returns the current String in which first letter changed to title case:
Example: String s = ‘hello maximillian’; String s2 = s.capitalize(); System.assertEquals(‘Hello maximillian’, s2);