Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 strint help please
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Bakon




PostPosted: 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... Very Happy

Its sometihng like:

strint myVariable(myVariableStr)... I dont know :S
Sponsor
Sponsor
Sponsor
sponsor
Cervantes




PostPosted: 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.
Bakon




PostPosted: 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)
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 3 Posts ]
Jump to:   


Style:  
Search: