Discussions related to Visual Prolog
george123
Posts: 3
Joined: 6 Apr 2014 14:59

Integer to string

Unread post by george123 »

Hello guys

if i have an integer: Counter and i want to get the string i use toString(Counter)

if i have a string: Money = "10" and i want to make how can i convert it to integer ??


and if i have the integer: Value = 10 and i want to convert it to positive, how can i do that ??

so i want

i) string to integer

and
ii) integer to positive

Thank you
User avatar
Thomas Linder Puls
VIP Member
Posts: 1398
Joined: 28 Feb 2000 0:01

Unread post by Thomas Linder Puls »

Code: Select all

tryToTerm(integer, String) % will fail if String is not an integer toTerm(integer, String) % will raise an exception if String is not an integer

Code: Select all

tryConvert(positive, Integer) % will fail if Integer cannot be converted to a positive concert(positive, Integer) % will raise an exception if Integer cannot be converted to a positive
Regards Thomas Linder Puls
PDC
Post Reply