I have a custom list list<ExistingAccountResult> that contains the following values:

([accountid=00111111111w5YIQAY, includeinfunnel=true, masterid=11111111, salesforceaccountid=O-22222222, status=Active], [accountid=0011111111w5YIQAY, includeinfunnel=true, masterid=244444445, salesforceaccountid=O-2333335, status=Active])

In this case I have two elements, but my list may contain many more depending on the scenario. What would be the best way to get into each element in the list and only remove the first value (accountid=...) from each element?

I was thinking converting the list to a list<String> and then look at each element from the new list, and strip the value, but this does not seem like an efficient way to do this.

  • 1
    Why not use a simple for loop with an assignment statement? What is driving the complexity here? – David Reed May 12 at 15:07
  • 1
    I would question why do you have a list like this, what is the list actually supposed to contain? Accounts records? – PepeFloyd May 12 at 15:07
  • I guess I was overthinking it. I just run though a loop and assigned each element to a string where I did the removal of characters, and then added to a new list of strings, and it seems to be working. Thanks – Ivo Dimov May 12 at 15:50
  • 1
    This appears to be a debug of a custom object. I'm not clear on why string manipulation comes into play. That approach is likely to yield poor performance. Editing this question to be clearer about what exactly you're trying to do could be helpful. – David Reed May 12 at 17:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.