[BUG]Text getFirstCharacter

Karl Ramberg karl.ramberg at chello.se
Sun Sep 21 20:16:59 UTC 2003


I made a L-system parser and had it read characters one by one from 
a text (TextMorph) using the getFirstCharacter tile, and assigning them
to a variable:
myMorph's text: text getFirstCharacter.
This works fine but when I use the variable in a test it will fail
because it has 
actually gotten a character and not a string.
myMorph's text = 'G' -> false
myMorph's text = $G  -> true.

I would think this is a bug in TextMorph>>getFirstCharacter which should read:

TextMorph>>getFirstCharacter
	"obtain the first character from the receiver if it is empty, return a  
	black dot"
	| aString |
	^ (aString _ text string) isEmpty
		ifTrue: ['•']
		ifFalse: [aString first asString]
                                   ^^^^^^^^



Karl
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Etoy getFirstCharacter.2.cs.gz
Type: application/octet-stream
Size: 455 bytes
Desc: Unknown Document
Url : http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20030921/ee7f4b9c/EtoygetFirstCharacter.2.cs.obj


More information about the Squeak-dev mailing list