Monday, September 7, 2020

How to get First day of the month using apex in salesforce

 Sample Code

System.debug('First Day ==> '+Date.today().toStartOfMonth());

Output

Thursday, September 3, 2020

Remove spaces from a string using apex in Salesforce

Use the deleteWhitespace() to remove spaces from a string in Salesforce.

Ex:

String str = 'Salesforce Code Crack';
system.debug(str.deleteWhitespace());
Output