Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #6388

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

From "Oleksandr Rasputinov" <oleksandr_rasputinov@hmamail.com>
Newsgroups comp.soft-sys.math.mathematica
Subject Re: Converting a list of strings to a single space-delimited string
Date 2011-11-11 12:34 +0000
Organization Steven M. Christensen and Associates, Inc and MathTensor, Inc.
Message-ID <j9j4oa$a7g$1@smc.vnet.net> (permalink)
References <j9geh9$ovb$1@smc.vnet.net>

Show all headers | View raw


On Thu, 10 Nov 2011 12:02:49 -0000, Andrew DeYoung  
<adeyoung@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"

Back to comp.soft-sys.math.mathematica | Previous | Next — Previous in thread | Find similar | Unroll thread


Thread

Converting a list of strings to a single space-delimited string Andrew DeYoung <adeyoung@andrew.cmu.edu> - 2011-11-10 12:02 +0000
  Re: Converting a list of strings to a single space-delimited string Ray Koopman <koopman@sfu.ca> - 2011-11-11 09:54 +0000
  Re: Converting a list of strings to a single space-delimited string David Bailey <dave@removedbailey.co.uk> - 2011-11-11 10:07 +0000
  Re: Converting a list of strings to a single space-delimited string Armand Tamzarian <mike.honeychurch@gmail.com> - 2011-11-11 10:08 +0000
  Re: Converting a list of strings to a single space-delimited string "Dr. Wolfgang Hintze" <weh@snafu.de> - 2011-11-11 10:08 +0000
    Re: Converting a list of strings to a single space-delimited string "Dr. Wolfgang Hintze" <weh@snafu.de> - 2011-11-12 12:40 +0000
  Re: Converting a list of strings to a single space-delimited string "Oleksandr Rasputinov" <oleksandr_rasputinov@hmamail.com> - 2011-11-11 12:34 +0000

csiph-web