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

brent.pinkney at aircom.co.za brent.pinkney at aircom.co.za
Mon Oct 4 17:46:31 UTC 2004


"Change Set:		abstractStringAsUnsignedInteger-brp
Date:			4 October 2004
Author:		Brent Pinkney

Refactor AbstractString>>#asUnsignedInteger.

Update 6286 AbstractStringAsIntegerTweak-laza fixes String>>#asInteger.
The implementation can be improved.

The logic in AbstractString>>#asUnsignedInteger is essentially
duplicated in as#Integer.

An unsigned integer is merely the absolute value of a signed integer.

Passes all tests in MultiStringTest

Hence:

asUnsignedInteger
	^ self asSignedInteger
		ifNotNilDo: [:i | i abs]

"
-------------- next part --------------
A non-text attachment was scrubbed...
Name: abstractStringAsInteger-brp.cs.gz
Type: application/octet-stream
Size: 1099 bytes
Desc: not available
Url : http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20041004/5adac7e7/abstractStringAsInteger-brp.cs.obj


More information about the Squeak-dev mailing list