1 /** 2 @ Name SFApexUtilFunctions 3 @ Author Aslam Bari 4 @ Created Date 31 March, 2011 5 @ Description A utility methods class for helping developers community 6 */ 7 public class SFApexUtilFunctions{ 8 9 /** 10 @ Name join 11 @ Author Aslam Bari 12 @ Created Date 31 March, 2011 13 @ Desctiption Join one list of String to a full string 14 @ Param List<String>: list of string data 15 @ Param separator: the string by which the list is joined 16 */ 17 public static string join(List<String> lstArg, String separator){ 18 String fullString = ''; 19 for(String item: lstArg){ 20 fullString += item + separator; 21 } 22 if(fullString.length() > 0) 23 fullString = fullString.substring(0, fullString.length() - 1); 24 25 return fullString; 26 } 27 28 /** 29 @ Name getUrlContents 30 @ Author Aslam Bari 31 @ Created Date 31 March, 2011 32 @ Desctiption Fetch the contents of remote url 33 @ Param url: remote url with all parameters attached to url for GET call 34 */ 35 public static string getUrlContents(String url){ 36 HttpRequest request = new HttpRequest(); 37 request.setEndPoint(url); 38 request.setMethod('GET'); 39 Http call = new Http(); 40 HttpResponse response = call.send(request); 41 return response.getBody(); 42 } 43 }