string -> cislo

Honza Pazdziora adelton na informatics.muni.cz
Čtvrtek Duben 25 12:38:05 MEST 2002


On Thu, Apr 25, 2002 at 11:13:06AM +0200, Jindrich Kubec wrote:
> 
> V souboru mam cisla ulozeny pomoci sprintf( "%08d", $x );
> 
> Jak precist zpatky a dostat ze stringu cislo bez tech nul vlevo? 
> 
> Delam:
> 
> $cislo = ( $str_cislo + 1 ) - 1; 
> 
> ;-)
> 
> Jde to hezceji?

$cislo = $str_cislo + 0;
($cislo = $str_cislo) =~ s/^0+//;

-- 
------------------------------------------------------------------------
 Honza Pazdziora | adelton na fi.muni.cz | http://www.fi.muni.cz/~adelton/
      ... all of these signs saying sorry but we're closed ...
------------------------------------------------------------------------


Další informace o konferenci Perl