Re: Strings to Integers
- To: mathgroup at smc.vnet.net
- Subject: [mg67620] Re: [mg67566] Strings to Integers
- From: Bruce Colletti <vze269bv at verizon.net>
- Date: Sun, 2 Jul 2006 06:28:04 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
Virgil
Try this (done under v5.2.0.0).
X = {"12:30", "05:15", "12:00"};
Y = Map[StringCases[#, min__ ~~ ":" ~~ sec__ -> ToExpression@{min, sec}] &, X];
Flatten[Y, 1]
Bruce
=====================
From: Virgil Stokes <vs at it.uu.se>
To: mathgroup at smc.vnet.net
Subject: [mg67620] [mg67566] Strings to Integers
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?
--Thanks,
V. Stokes