Simple Apex Class to return list of string based on the length provided

Simple Apex Class to return list of string based on the length provided

Sample Code:

public class StringArrayTest {
    public static List<String> generateStringArray(Integer i) {
        List<String> listString = new List<String>();
        for(Integer j = 0; j < i ; j++) {
            listString.add(‘Test ‘ + j);
        }
        return listString;
    }
}

Cheers!!!

Leave a Reply