Premise
So I’m trying to break up a given String into a list of characters, these characters will then be edited/changed and reassigned into the list after which the list will be reconstructed back into a String.
An example:
Given String : "ABCDEFG"
Character list : [A,B,C,D,E,F,G]
Operation changes the list to something like the following:
[E,F,G,H,I,J,K] (Or something similar).
And then gets reconstructed into a String:
"EFGHIJK"
Question
I am looking for a way to access individual elements inside of a String. If it were Java I would use a command like charAt(int i) but I don’t know if such a command exists within prolog.
Note
I am a new prolog programmer so I’m not familiar with most prolog operations.
Thanks for your time.
A string it’s a list of char codes, while an atom it’s, well, atomic, i.e. indivisible, but there is sub_atom/5 to access parts of the atomic data.
Here some string example:
If the analysis and transformation require detail then usually it’s better to use DCGs