[ENH] String and Character conversion methods

German Morales germanmorales at delta-sys.com
Mon Aug 2 20:20:19 UTC 2004


Hi Cancerbero,

It seems that Cancerbero wrote:
> So my suggesiont is to add a method String>>asFloat.

There are already some conversion methods you can use.

For example,
   Float readFrom: '3.14'.
does what you want (it uses the Compiler to evaluate the text).

Perhaps you will want to anyway define String>>asFloat as

String>>asFloat
   ^ Float readFrom: self.


> Character>>asDigit
> "Example : $4 asDigit will return the SmallInteger 4"

$4 digitValue
does that conversion.

Bye!

German Morales
(aka Yoda)





More information about the Squeak-dev mailing list