strint help please
Author |
Message |
Bakon
|
Posted: Thu May 12, 2005 5:23 pm Post subject: strint help please |
|
|
Okay, so what Im doing is getting text from the GUI.CreateTextField function, but this text is a string. So what i need to do is convert the string variable, into an integer variable so that I can do for example var1 + var2, right now because of the text being a string, it cannot perform this calculation. I usefd to knwo how, can someone please refresh my memory...
Its sometihng like:
strint myVariable(myVariableStr)... I dont know :S |
|
|
|
|
![](images/spacer.gif) |
Sponsor Sponsor
![Sponsor Sponsor](templates/subSilver/images/ranks/stars_rank5.gif)
|
|
![](images/spacer.gif) |
Cervantes
![](http://compsci.ca/v3/uploads/user_avatars/1023105758475ab2e040bde.jpg)
|
Posted: Thu May 12, 2005 5:34 pm Post subject: (No subject) |
|
|
strint (s : string [, base : int]) : int
Ex.
code: |
num := strint (input)
|
Base 10 is assumed.
You'll also want to check if the string can be successfully turned into an integer. For this, use strintok
Ex.
code: |
get input
if strintok (input) then
num := strint (input)
end if
|
Please, check the help file and the turing tutorials first. The help file explains this well enough, and I recently wrote a tutorial on this. It's called String Manipulation, if you want to look. |
|
|
|
|
![](images/spacer.gif) |
Bakon
|
Posted: Thu May 12, 2005 8:04 pm Post subject: (No subject) |
|
|
Sadly this did not work:
this is the input, it takes the input from the text field...
numeratorTextField := GUI.CreateTextFieldFull (26, 500, 100, "",
numerator_proc, GUI.INDENT, 0, 0)
this is the conversion code
numeratorTextField := strint (numeratorTextFieldstr) |
|
|
|
|
![](images/spacer.gif) |
|
|