- Original Message -
From: "Naresh Bajaj" <[EMAIL PROTECTED]>
To:
Sent: Wednesday, March 22, 2006 2:28 AM
Subject: Extracting numbers from a string
Hello all,
I have one string PT2H46M7.815S.
It is in hours, minutes and seconds. I want to extract number between
the alphabets and
store
veState.com
cc:
Subject: Re: Extracting numbers from a string
How about using a regex
if($string =~ /PT(\d+)H(\d+)M(\d+).(\d+)/){
$1=$hr;
$2=$min;
$3=$sec;
$time = ($hr*3600)+($min*60)+$sec;
}
untested
At 07:28 PM 3/21/20
[EMAIL PROTECTED] wrote on 03/21/2006 09:48:28
PM:
> Today's Topics:
>
>7. Extracting numbers from a string (Naresh Bajaj)
> --
> --
>
> Message: 7
> Date: Tue, 21 Mar 2006 19:28:41 -0600
> From:
Naresh Bajaj wrote:
> Hello all,
> I have one string PT2H46M7.815S.
> It is in hours, minutes and seconds. I want to extract number between
> the alphabets and
> stored in seconds. How should I approach this problem.
> Right now I am using the split command which is not much elegant way.
> Crude m
In a message dated 3/21/2006 9:10:13 P.M. Eastern Standard Time,
[EMAIL PROTECTED] writes:
> Hello all,> I have one string PT2H46M7.815S.> It is in
hours, minutes and seconds. I want to extract number between> the
alphabets and> stored in seconds. How should I approach this
problem.> Righ
> -Original Message-
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] Behalf
> Of Naresh
> Bajaj
> Sent: Wednesday, 22 March 2006 12:29 PM
> To: activeperl@listserv.ActiveState.com
> Subject: Extracting numbers from a string
>
>
> Hello all,
> I have one string PT2H46M7.815S.
> It
How about using a regex
if($string =~ /PT(\d+)H(\d+)M(\d+).(\d+)/){
$1=$hr;
$2=$min;
$3=$sec;
$time = ($hr*3600)+($min*60)+$sec;
}
untested
At 07:28 PM 3/21/2006, Naresh Bajaj wrote:
Hello all,
I have one string PT2H46M7.815S.
It is in hours, minutes a