function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
MellowYellowMellowYellow 

How to create array of characters from a string

I'm trying to find a way to read a string into an array (<list>).  I know that I can get the string.Length and then loop through from 1 to Length, but I can't figure out how to get the character at position.loop_counter in the string.  This is for a custom apex controller.

 

Thanks!

 

 

Best Answer chosen by Admin (Salesforce Developers) 
@dsmith_vr@dsmith_vr

Couldn't you grab each character with substring?

 

stringToChopUp.substring(loop_counter,loop_counter+1)