Path: csiph.com!x330-a1.tempe.blueboxinc.net!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!nx01.iad01.newshosting.com!newshosting.com!news-out.readnews.com!transit4.readnews.com!newspump.sol.net!post2.nntp.sol.net!posts.news.twtelecom.net!nnrp2.twtelecom.net!not-for-mail From: Ray Koopman Newsgroups: comp.soft-sys.math.mathematica Subject: Re: Converting a list of strings to a single space-delimited string Date: Fri, 11 Nov 2011 09:54:55 +0000 (UTC) Organization: Steven M. Christensen and Associates, Inc and MathTensor, Inc. Sender: steve@smc.vnet.net Approved: Steven M. Christensen , Moderator Message-ID: References: Lines: 29 NNTP-Posting-Date: 11 Nov 2011 08:59:01 GMT NNTP-Posting-Host: 873e240f.news.twtelecom.net X-Trace: DXC=^TN32MX73NLPM\O\]?9b9MC_A=>8kQj6Mm^eQlV`f18GKPOmcJW0TkFEFiONJ7[GoFWOX_S2YkKTH X-Complaints-To: abuse@twtelecom.net Xref: x330-a1.tempe.blueboxinc.net comp.soft-sys.math.mathematica:6358 On Nov 10, 4:02 am, Andrew DeYoung 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[1]:= s = "1 2 3"; t = StringSplit[s] StringJoin@Riffle[t, " "] === s Out[2]= {"1", "2", "3"} Out[3]= True