[FIX][BUG] Conversion of String to Number don''t check negatives ([cd][er][su][et][sm] resubmit )

Alexander Lazarević Alexander at Lazarevic.de
Mon Oct 4 22:22:43 UTC 2004


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
 
I made the second version of that fix in a hurry and just noticed that
after I submitted the code. I hesitated to send a changed fix right
away, because I had doubts that this is really the best solution.
Now I think we better should make asInteger be equivalent to asNumber

asInteger
~    ^Integer readFromString: self

and have a new method firstInteger (or extractFirstInteger) that does
the job of former asInteger, but to return 0 instead of nil in case
there are no digits in the string. This would be the changes for the
senders

asInteger            firstInteger
asSignedInteger      firstInteger
asUnsignedInteger    firstInteger abs


Alex
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (MingW32)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org
 
iD8DBQFBYc0yYiF2wSTEZ9gRAuEaAKDkfsE81Z0N4z2nCXgKGr56cvnDEgCgzgWd
6r+5B0eLePZj4k7/b11hEwg=
=yQm+
-----END PGP SIGNATURE-----




More information about the Squeak-dev mailing list