Subscribe Bookmark RSS Feed

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

djhanson

Community Trekker

Joined:

Jun 23, 2011

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
ms

Super User

Joined:

Jun 23, 2011

This seem to work:
djhanson

Community Trekker

Joined:

Jun 23, 2011

Thanks very much!