Play Games

Search This Blog

Thursday, April 21, 2022

How to convert string to an array in Apex - Salesforce Globe For You

How to convert string to an array in Apex - Salesforce Globe For You

Solution: Use split('') to convert string to array.

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

List<String> lstCharacter = new List<String>();

String str = 'Salesforce Globe For You';

lstCharacter = str.split('');

system.debug('String Array: '+lstCharacter);

Output:



No comments:

Post a Comment