I have this method below that Returns a String of Id's separated by '|' operator and it works. However now I would like to add on that if an Id is null or blank replace with just single quotes (''). Not sure how to do that. How can i modify this method to do that.
public static string getString(Set<Id> setId)
{
String strId = '';
if(setId != null && setId.size() > 0 )
{
for(Id RecordId :setId)
{
String strRecordId = RecordId;
if(strRecordId.length() > 15){
strRecordId = strRecordId.substring(0,15);
}
strRecordId = '\''+ strRecordId + '\'';
strId += strRecordId + '|';
}
strId = strId.removeEnd('|');
}
return strId;
}