From: Xavier Noria on
On Tue, Jan 19, 2010 at 3:37 PM, Rick DeNatale <rick.denatale(a)gmail.com> wrote:

> def safe_string_to_int(string)
>     if /^\d+$/.match(string)

\A and \z would be better surely for the same price.

From: Rick DeNatale on
On Tue, Jan 19, 2010 at 10:52 AM, Xavier Noria <fxn(a)hashref.com> wrote:
> On Tue, Jan 19, 2010 at 3:37 PM, Rick DeNatale <rick.denatale(a)gmail.com> wrote:
>
>> def safe_string_to_int(string)
>>     if /^\d+$/.match(string)
>
> \A and \z would be better surely for the same price.

Yep.
--
Rick DeNatale

Blog: http://talklikeaduck.denhaven2.com/
Twitter: http://twitter.com/RickDeNatale
WWR: http://www.workingwithrails.com/person/9021-rick-denatale
LinkedIn: http://www.linkedin.com/in/rickdenatale

First  |  Prev  | 
Pages: 1 2
Prev: ruby for TT
Next: Solar System (#227)