Choose Language Hide Translation Bar
Highlighted
djhanson
Level V

How to substitute a partial string into list elements..??

Hi, quick question. Say I have a list:

list1 = {"ABC_100", "ABC_178", "ABC_234"};

How to substitute say "XYZ" string into each "ABC" of the list elements above?

I tried the following to no avail as substitute seems to want an exact match.
list2 = substitute(list1, "ABC", "XYZ"); ..doesn't work
list2 = substitute(list1, "ABC?", "XYZ"); ..doesn't work with the ? wildcard

Any help appreciated... dj
2 REPLIES 2
Highlighted
ms
Super User ms
Super User

Re: How to substitute a partial string into list elements..??

This seem to work:
Highlighted
djhanson
Level V

Re: How to substitute a partial string into list elements..??

Thanks very much!
Article Labels

    There are no labels assigned to this post.