I stumbled into RED language the other day and spend (more or less literally) the last 24h "learning" it. I exhausted my googling skills trying to find solution for a simple problem that just evades my skills and logic, so hopefully somebody here can lead me to path to righteousness.
As the title suggest, I tried to parse a simple string (any string of random text, really), get the individual char(acter)s and then tried to save them into a variable. (Another string/array/any type really)
The best I could do was with code using:
alpha: charset [#"a" - #"z"]
testString: "this is just random rambling to test parsing!"
as prerequisites and something like this when (trying to) parse:
probe parse teststring [copy text to alpha (append text2 to-integer(to-char text)) to end]
Saves the (first letter) ascii code to text2 and running the script several times properly adds the (same first letter) ASCII code several times in a row:
CONSOLE OUTPUT
>> probe parse teststring [copy text to alpha (append text2 to-integer(to-char text)) to end]
true
== true
>> probe text2
"34"
== "34"
>> probe parse teststring [copy text to alpha (append text2 to-integer(to-char text)) to end]
true
== true
>> probe text2
"3434"
== "3434"
Obviously my parsing is not really "looping" the individual characters of the string or not saving them properly while doing it. Maybe my parsing really takes the whole string from TO till END and I try to then convert that to ASCII code or something else is happening here?
ANY help will be greatly appreciated, as I cannot possibly advance with my RED learning before solving this dilemma and understanding how the parsing really works in RED.