Advertisement
Guest User

Untitled

a guest
Jan 29th, 2020
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.53 KB | None | 0 0
  1. //convert a Set<String> into a quoted, comma separated String literal for inclusion in a dynamic SOQL Query
  2. private static String quoteKeySet(Set<String> mapKeySet)
  3. {
  4. String newSetStr = '' ;
  5. for(String str : mapKeySet)
  6. newSetStr += '\'' + str + '\',';
  7.  
  8. newSetStr = newSetStr.lastIndexOf(',') > 0 ? '(' + newSetStr.substring(0,newSetStr.lastIndexOf(',')) + ')' : newSetStr ;
  9. System.debug('quoteKeySet() : newSetStr ============ ' + newSetStr);
  10.  
  11. return newSetStr;
  12.  
  13. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement