MathGroup Archive 2010

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

Search the Archive

Re: Combining elements of a list

  • To: mathgroup at smc.vnet.net
  • Subject: [mg108867] Re: Combining elements of a list
  • From: Tomas Garza <tgarza10 at msn.com>
  • Date: Sun, 4 Apr 2010 07:47:32 -0400 (EDT)

Make sure each letter in your {h,e,l,l,o} is a string, i.e., that it is actually

{"h", "e", "l", "l", "o"}

Then use StringJoin:

In[1]:== StringJoin[{"h", "e", "l", "l", "o"}]

Out[1]== "hello"

Do the same for {"This", " ", "is", " ", "a", " ", "test", " ", "message"}, but remember to type the spaces between each word.

In[2]:== StringJoin[{"This", " ", "is", " ", "a", " ", "test", " ",
  "message"}]

Out[2]== "This is a test message"

Tomas


> Date: Sat, 3 Apr 2010 06:09:05 -0500
> From: ebaugh at illinois.edu
> Subject: [mg108845] Combining elements of a list
> To: mathgroup at smc.vnet.net
>
>
> How could I go from:

> to> {h,e,l,l,o}
> {hello}?
>
> That is the first step of what I am really looking to do. Which is
> to go from:
> {{t,h,i,s},{i,s},{a},{t,e,s,t},{m,e,s,s,a,g,e}}
> to
> "this is a test message"
>
> Thanks all,
> Jason Ebaugh
>
>


  • Prev by Date: Re: convert txt to binary file
  • Next by Date: Re: 10.6.3 and Home Edition crashes
  • Previous by thread: Re: Combining elements of a list
  • Next by thread: Re: Combining elements of a list