MathGroup Archive 2006

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

Search the Archive

Re: Strings to Integers

  • To: mathgroup at smc.vnet.net
  • Subject: [mg67611] Re: Strings to Integers
  • From: Bill Rowe <readnewsciv at earthlink.net>
  • Date: Sun, 2 Jul 2006 06:27:24 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com

On 7/1/06 at 5:11 AM, vs at it.uu.se (Virgil Stokes) wrote:

>The following is an example of a list that contains times in
>min:sec,

>{12.33, 120:03, 343:59, 1:00}

>where each element is of String type.

>Is there a "smart" way to convert lists such as this into Integer
>type for both minutes and seconds?

I am going to assume there is a typo in you list above and the first item should be 12:33. If I have this correct, then the following will do what you want.

In[1]:=
t={"12:33","120:03","343:59","1:00"};
Map[ToExpression,StringSplit[#,":"]&/@t,{2}]

Out[2]=
{{12, 33}, {120, 3}, {343, 59}, {1, 0}}
--
To reply via email subtract one hundred and four


  • Prev by Date: Re: Strings to Integers
  • Next by Date: Incomplete Gamma function
  • Previous by thread: Re: Strings to Integers
  • Next by thread: RE: Strings to Integers