text to numeric variable

More
1 week 2 days ago - 1 week 2 days ago #110 by ludojoey
Hi!

I may have missed something, but I can't find anywhere how to convert a text variable into a numeric value (a nat, for example).Example:
Code:
text t; nat tnat; print("Enter a number between 0 and 999:"); input(t,3);

At this point, I would like to use the value entered by the user as a numeric variable and perform calculations with it.How can I do that?
Code:
tnat = (nat)t;

doesn't work (type mismatch).

Any hints?
Thanks !
Last edit: 1 week 2 days ago by ludojoey.

Please Log in or Create an account to join the conversation.

More
1 week 12 hours ago #113 by Franck
Replied by Franck on topic text to numeric variable
There is a text to int function in the Utils folder
The following user(s) said Thank You: PAGIR, ludojoey

Please Log in or Create an account to join the conversation.

More
1 week 12 hours ago #114 by ludojoey
Replied by ludojoey on topic text to numeric variable
Thanks ! Shame on me I didn't saw it !
The following user(s) said Thank You: Franck

Please Log in or Create an account to join the conversation.

Time to create page: 0.166 seconds
Powered by Kunena Forum