Replace function in String using Apex in Salesforce
Simple Replace Code: String str = 'RAM'; System.debug( 'Replace value is ' + str.replace( 'A', 'O' ) ); Output: Sample Multi-Level or multiple characters replace Code: String str = 'test'; ....
Simple Replace Code: String str = 'RAM'; System.debug( 'Replace value is ' + str.replace( 'A', 'O' ) ); Output: Sample Multi-Level or multiple characters replace Code: String str = 'test'; ....
format() will remove the time stamp from Date. Sample Code: Date dat = System.Today(); System.debug(dat.format()); format() is used to get Date from Datetime using Salesforce Apex.
To get Session Id using Apex in Salesforce, UserInfo.getSessionId() is used. Sample Code: String sessionId = UserInfo.getSessionId(); Note: For Apex code that is executed asynchronously, such as @future methods, Batch Apex ....
UserInfo.getOrganizationId() can be used to fetch the Salesforce organization id using Apex. Sample Code: Id OrgId = UserInfo.getOrganizationId(); System.debug( 'Org Id is ' + OrgId ); UserInfo.getOrganizationId() allows us to ....
escape attribute in Salesforce Visualforce is used to determine whether the HTML and XML characters should be escaped in the HTML output generated by the component or not. For example, ....
getOrgDomainUrl() can be used in Salesforce Apex to get your org URL. getCurrentRequestUrl() can used in Salesforce Apex to get the URL of an entire request on a Salesforce instance. ....
isNumeric() can be used to check whether a string is numeric using Apex in Salesforce. Sample Code: String str = 'abc'; if ( str.isNumeric() ) { Integer intVal = Integer.ValueOf( ....
JSON.serialize() method can be used to create JSON String using Apex in Salesforce. Check the following code for reference Sample Code: Account objAccount = [ SELECT Id, Name, Phone, Website, ....
Date.daysInMonth() can be used to find the number of days for a month using Apex in Salesforce. Sample Code: Integer numberDays = Date.daysInMonth( 2014, 2 ); System.debug( 'No of days ....
Currency format in Salesforce Visualforce Page can be done using apex:outputText and apex:outputField. Example: <apex:outputText value="${0, number, ###,###,###,##0.00}"> <apex:param value="{!a}" /> </apex:outputText> <apex:outputText value="{0, number, currency}"> <apex:param value="{!inte}"/> </apex:outputText> Note: ....