[ENH] String and Character conversion methods

lex at cc.gatech.edu lex at cc.gatech.edu
Sun Aug 1 20:04:27 UTC 2004


Cancerbero <sgurin at montevideo.com.uy> wrote:
> My situation is this: The user's input is a String representing a
> floating point number, so I want something that converts a String
> representing a floating point number to a Float. Example: Something like
> String>>asFloat so '3.14' asFloat returns the Float 3.14. 
> 
> So my suggesiont is to add a method String>>asFloat. For example: 

That's a nice method to have around, but it should be implemented by
using the same code that is already present for reading floats.  That
code can be used like this:

	Float readFromString: '3.14'

The thing is, it would be nice if asFloat does *exactly* the same thing
as "Float readFromString:", and if future tweaks to either one also take
effect on the other.


-Lex



More information about the Squeak-dev mailing list