Created
May 10, 2020 03:51
-
-
Save matsukawar/f965369e3ea5b8cb09899e343a0eb754 to your computer and use it in GitHub Desktop.
Create an Apex class with a method that returns an array (or list) of strings.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class StringArrayTest { | |
public static List<String> generateStringArray(Integer length) { | |
List<String> retArray = new List<String>(); | |
for(Integer cnt = 0; cnt < length; cnt++){ | |
List<String> params = new List<String>{ String.valueOf(cnt) }; | |
String elemStr = String.format('Test {0}', params); | |
retArray.add(elemStr); | |
System.debug(elemStr); | |
} | |
return retArray; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
public class StringArrayTest {
public static List generateStringArray (Integer length) {
List strList = new List();
for(Integer i=0; i<length; i++) {
String text ='Test ' + i;
strList.add(text);
}
System.debug(strList);
return strList;
}
}