4
$\begingroup$

Suppose I have the following string list:

l={{"a","dog"},{"the","pen"}}

how can I turn this to

{{"a dog"},{"the pen"}}

I tried StringJoin yet that gives

{{"adog"},{"thepen"}}
$\endgroup$
  • $\begingroup$ Look at StringRiffle. $\endgroup$ – Jason B. Nov 29 '18 at 17:26
  • $\begingroup$ @JasonB. I have but that does not a list format. $\endgroup$ – William Nov 29 '18 at 17:29
  • $\begingroup$ even if I do {l // StringRiffle} I get {"a dog\nthe pen"} $\endgroup$ – William Nov 29 '18 at 17:30
4
$\begingroup$
List /@ StringRiffle /@ l

{{"a dog"}, {"the pen"}}

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.