Quantcast
Channel: Active questions tagged string-manipulation - Mathematica Stack Exchange
Viewing all articles
Browse latest Browse all 200

Replacement of strings within lists

$
0
0

i have a string list:

lis = {"a",{"b","c"},"d"}

...and would like to replace "c" with "Q", to give

res = {"a",{"b","Q"},"d"}

StringReplace works if I flatten lis beforehand, but I want to preserve the structure of lis.

Thanks for ideas for this simple question.


Viewing all articles
Browse latest Browse all 200

Trending Articles