[ENH] CharDigitValueEnh.08Sep0335

Robert Hirschfeld hirschfeld at acm.org
Sat Sep 8 01:46:44 UTC 2001


"Change Set:		CharDigitValueEnh
Date:			8 September 2001
Author:			Robert Hirschfeld

Allows the use of lowercase letters in Character>>digitValue as well."
-------------- next part --------------
A non-text attachment was scrubbed...
Name: CharDigitValueEnh.08Sep0335.cs.gz
Type: application/x-gzip
Size: 429 bytes
Desc: not available
Url : http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20010907/3d1804ed/CharDigitValueEnh.08Sep0335.cs.bin
-------------- next part --------------
'From Squeak3.1alpha of 7 March 2001 [latest update: #4325] on 8 September 2001 at 3:35:50 am'!
"Change Set:		CharDigitValueEnh
Date:			8 September 2001
Author:			Robert Hirschfeld

Allows the use of lowercase letters in Character>>digitValue as well."!


!Character methodsFor: 'accessing' stamp: 'rhi 8/17/2001 08:56'!
digitValue
	"Answer 0-9 if the receiver is $0-$9, 10-35 if it is $A-$Z or $a-$z, and < 0 otherwise.
	This is used to parse literal numbers of radix 2-36."

	value <= $9 asciiValue 
		ifTrue: [^value - $0 asciiValue].
	value >= $A asciiValue 
		ifTrue: [value <= $Z asciiValue ifTrue: [^value - $A asciiValue + 10]].
	value >= $a asciiValue 
		ifTrue: [value <= $z asciiValue ifTrue: [^value - $a asciiValue + 10]].
	^ -1! !



More information about the Squeak-dev mailing list