I have two strings, e.g., s1="A|P|Q|Z"
and s2="r|ss|t|yy"
, where "|"
is meant to be a separator. I would like to get the result as another string s=Ar|Pss|Qt|Zyy
by joining the corresponding parts of the two strings s1
and s2
as indicated by the separators. What would be a simple way to do this?
$\begingroup$
$\endgroup$
Add a comment
|
1 Answer
$\begingroup$
$\endgroup$
1
Try this:
StringSplit[{s1, s2}, "|"] // Transpose // StringRiffle[#, "|", ""] &