what am I trying is to switch each character in string with one next ( a-> b, y -> z, etc). Not sure though how do I do that in Smalltalk and tried to combine like that:
x := 'costam'.
y := x asArray.
y do: [:charr | charr := charr + 1. ].
y do: [:char | Transcript show: char printString; cr].
What I do is: iterate over array and increase each character.. though it doesn’t work. I get error: attempt to store into argument. How do I get around that and do it proper way?
Now I got something like this:
x := 'costam'.
y := x asArray.
b := y at: 2.
n := 1.
m := 5.
[ n < m ] whileTrue: [
n := n + 1.
y at: n put: 'a'.
Transcript show: (y printString).
].
Problem that remains is how do I ‘increase’ characters like a -> b g -> h etc?
SOLVED
Try this: