Play Games

Search This Blog

Thursday, April 21, 2022

How to find the length of a string in Apex - Salesforce Globe For You

How to find the length of a string in Apex - Salesforce Globe For You

Solution: Use the length() to return the number of characters in the string.

Example:

Run the following piece of code from anonymous window of developer console

String str = 'Salesforce Globe For You';

Integer iLength = str.length();

system.debug('Length of the String: '+iLength);

Output:



No comments:

Post a Comment