Tomaso Tosolini
12/29/2007 1:17:00 PM
Dipesh Batheja wrote:
> Is there any function in ruby which allows you to trim leading zeros (or
> any specific character) from a string. Or if there is some reg
> expression that i can use?
Hi
if you have string expressions like
s = 0{1,*}[1-9]* (some number with leading zeros)
perhaps the must obvious method is
s.to_i.to_s
:)
but this isn't genralizable to other kind of leading characters,
for them a regexp may be better
Tom