Newsgroups: comp.lang.smalltalk
Path: cantaloupe.srv.cs.cmu.edu!rochester!udel!news.mathworks.com!newsfeed.internetmci.com!news.sprintlink.net!cs.utexas.edu!news.ti.com!ticipa!clw
From: clw@ticipa.works.ti.com (Chris Winemiller)
Subject: Re: String to Integer
Message-ID: <1995Aug2.171720.4241@ticipa.works.ti.com>
Organization: None
References: <3vgvmo$1d6e@news.doit.wisc.edu>
Date: Wed, 2 Aug 1995 17:17:20 GMT
Lines: 25

In article <3vgvmo$1d6e@news.doit.wisc.edu> murdock@bob.wisc.edu (Larry Murdock) writes:
<snip>
>For example, after reading 'the Blue Book', 'Smalltalk V - Practice and
>Experience' as well as the Smalltalk V Manuals I am clueless as to
>how to convert from strings to integer, strings to floats, etc.

To convert to an Integer in Smalltalk/V, use #asInteger, like this:
    '125' asInteger
Also check to see if String defines other methods like #asFloat or
#asNumber.

<snip>
>At present the only thing that presents itself as a solution is to 
>go through the the characters of the string and use asciiValue to 
>build my own integers and floats. :-(  I suppose I would only have to 
>do it once but it seems the answer MUST be easier than that.

The answer is: Browse the String class, or (for Smalltalk/V) look at the
description of String in the Encyclopedia of Classes.

Chris
==============================================================
Chris Winemiller               Internet: clw@works.ti.com
Disclaimer: I do not speak for TI.
==============================================================
