I need to iterate over the characters in a string to build an XML structure.
Currently, I am doing this :
The FXSL library offers a number of generic functions for list processing. Almost all of them have an analog for operating on strings (regarding a string as a list of characters).
Here is an example using the str-foldl
function/template:
This transformation calculates the sum of the characters in the string passed as the $pStr
parameter and produces the correct result:
45
And using the str-map
template/function we have the following easy and short solution:
When applied on any XML file (not used), the wanted, correct result is produced:
S
o
m
e
T
e
x
t