So as the title says - how do you convert a string into an integer? the idea is something like this:
convert(String,Integer).
examples:
convert('1',1).
convert('33',33).
I'm using swi prolog
So as the title says - how do you convert a string into an integer? the idea is something like this:
convert(String,Integer).
examples:
convert('1',1).
convert('33',33).
I'm using swi prolog
Assuming you really meant a string and not an atom, use number_codes.
?- number_codes(11, "11").
true.
?- number_codes(11, Str).
Str = [49, 49]. % ASCII/UTF-8
?- number_codes(N, "11").
N = 11.
Perhaps use of atom_codes(?Atom, ?String) and number_chars(?Number, ?CharList) would do it.