Mathematica 9 is now available
Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2011

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Converting a list of strings to a single space-delimited string

  • To: mathgroup at smc.vnet.net
  • Subject: [mg122834] Re: Converting a list of strings to a single space-delimited string
  • From: "Oleksandr Rasputinov" <oleksandr_rasputinov at hmamail.com>
  • Date: Fri, 11 Nov 2011 07:33:16 -0500 (EST)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com
  • References: <j9geh9$ovb$1@smc.vnet.net>

On Thu, 10 Nov 2011 12:02:49 -0000, Andrew DeYoung  
<adeyoung at andrew.cmu.edu> wrote:

> 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
>

In addition to the suggestions already given, one may also use:

In[1]:= myList = {"1", "2", "3"};

In[2]:= ExportString[{"1", "2", "3"}, "Words"]

Out[2]= "1 2 3"



  • Prev by Date: Re: Pattern to match element in nested list
  • Next by Date: Re: CUDA XCompiler
  • Previous by thread: Re: Converting a list of strings to a single space-delimited string
  • Next by thread: Re: Converting a list of strings to a single space-delimited string