Quantcast
Viewing all articles
Browse latest Browse all 186

Conditional string replacement

I have a list of text and need to replace an element based on the text that appears in the element before it. Example of my list:

list={{"yes","can","fgh"},{"yes","can",""},{"yes","not","fgh"},{"yes","can","srts"},      {"yes","not","h"}}

I would like to replace all items in column 3 with "This" when column 2's entry is "can".

I have tried to do this using /. and If but without success. I think I need to use a rule but don't know the first thing about how to do this.


Viewing all articles
Browse latest Browse all 186

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>