Capitalize 1st letter in a String – Apex
Use “capitalize() “ to make first letter of a word as Capital.
Sample Code: Run the below piece of code in Apex execute of Workbench or Anonymous code on Dev Console
String str ='hello';
str= str.capitalize();
system.debug('Output String : '+str);
Output :
Is there method to make whole string as Capital in Apex? Thanks.
There is a method to UppserCase:
https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_methods_system_string.htm#apex_System_String_toUpperCase
Example: str.toUpperCase