Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

String to Integer Smalltalk

Pretty simple question I need to get an integer from the user and I only know how to get a string from them. So if there is a way to get an integer from the user or to convert the string to an integer please let me know.

like image 453
Anton Avatar asked Feb 09 '10 01:02

Anton


2 Answers

If you are using Squeak or Pharo, learn to use the "Message Finder".

Left click on the background, click Tools > Message Finder. Click on the top left pane. Type:

'12345'. 12345.

Hit Control-S and you have your answer. Specifically, you have three answers: asInteger, asNumber and initialIntegerOrNil.

like image 166
Turtle Avatar answered Sep 20 '22 12:09

Turtle


Found it:

'12345' asNumber.
like image 24
Anton Avatar answered Sep 18 '22 12:09

Anton