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

Randomly replace some letters in words with hyphen

$
0
0

I have a list containing some related words

list = {resident,  occupant,  tenant,  resider,  inhabiter,  habitant,          dweller,  citizen,  native,  denizen,  aborigine,  cohabitant};

The list contains words that have at least 4 letters. How can I make a list of the same words with some letters removed randomly and a hyphen placed instead? In each word, at least two 2 letters should be replaced.

desiredlist = {r-s-d-nt,  ---upant,  t-n---,  r-s-der,  -nh-bit-r,  h-bit-nt,                 -we-ler,  ci--zen,  n-t-ve,  -eni-en,  -bor-gine,  -ohab-t-nt};

Viewing all articles
Browse latest Browse all 186

Trending Articles



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