j
: Next unread message k
: Previous unread message j a
: Jump to all threads
j l
: Jump to MailingList overview
Hi,
I'm surprised there is no #isNumber selector for strings. If I want to detect if a string is a number or not, it's not so easy. One of the possible implementation would be:
String>>isNumber value := self asNumber. value isZero ifFalse: [^ true] ifTrue: [^ self first = $0]
But this is buggy and incomplete:
'dfdfd' isNumber false <- correct '12' isNumber true <- correct '0' isNumber true <- correct '0ef' isNumber true <- Wrong ! '2r0' isNumber false <- Wrong !
Should I open a bug report on Mantis ?
squeak-dev@lists.squeakfoundation.org