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

Merging certain list elements

$
0
0

I have a list of strings, some of which are all upper case, and some mixed upper and lower, and some are digits with commas:

lis = {"ABC","Abc","Def","1","DEF","Ghi","Jkl","MNO","1,"}

I would like to StringJoin adjacent elements that consist of mixed upper and lower cases to give:

res = {"ABC", "AbcDef","1","DEF","GhiJkl","MNO","1,"}

I can identify the elements of lis that contain lower case letters easily enough:

StringContainsQ[tes,CharacterRange["a","z"]

but I don't know how to make a rule to StringJoin adjacent elements that return True. Thanks for suggestions.


Viewing all articles
Browse latest Browse all 189

Trending Articles



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