Skip to main content
added 208 characters in body
Source Link
user58
  • 15
  • 1
  • 7

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.

I expect just to see the single quotes only. Example if have strings of ids my result = ('46734'|'3435') What I am looking for if no Ids then I would like to see result =('') or (''|'') not result = ()

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;
       }

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;
       }

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.

I expect just to see the single quotes only. Example if have strings of ids my result = ('46734'|'3435') What I am looking for if no Ids then I would like to see result =('') or (''|'') not result = ()

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;
       }
added 16 characters in body; edited tags
Source Link
user58
  • 15
  • 1
  • 7

I have this method that below that Returns a String of Id's separated by '|' operator and it works. NowHowever now I would like to add on this if andthat 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;
       }

I have this method that below that Returns String of Id's separated by '|' operator. Now I would like to add on this if and 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;
       }

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;
       }

I have this method that below that Returns String of Id's separated by '|' operator. Now I would like to add on this if and 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;
       }

I have this method that below that Returns String of Id's separated by '|' operator. Now I would like to add on this if and 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;
   }

I have this method that below that Returns String of Id's separated by '|' operator. Now I would like to add on this if and 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;
       }
Source Link
user58
  • 15
  • 1
  • 7
Loading