Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » Software » comp.soft-sys.math.mathematica

Topic: Converting a list of strings to a single space-delimited string
Replies: 9   Last Post: Nov 16, 2011 4:06 AM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
leigh pascoe

Posts: 30
Registered: 3/2/10
Re: Converting a list of strings to a single space-delimited string
Posted: Nov 16, 2011 4:06 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply



Le 10/11/2011 12:53, Andrew DeYoung a =C3=A9crit :
> Hi,
>
> I know that the command StringSplit can be used to convert a single
> space-delimited string to a list of strings. For example,
>
> B == "1 2 3";
> mylist == StringSplit[B]
>
> gives a list mylist such that mylist == {"1", "2", "3"}.
>
> But what if I would like to go in the reveres direction -- convert
> {"1", "2", "3"} to "1 2 3"? Is there a good way to do this, other
> than using a For loop and concatenating the elements of the list
> together?
>
> Thanks so much.
>
> Andrew DeYoung
> Carnegie Mellon University
>
>

StringJoin[Riffle[mylst, " "]]

LP




Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.