Borland Pascal Wiki
Borland Pascal Wiki
 This script page was blocked. The script was reviewed and it works perfectly so this page doesn't need anymore editing.

This script demonstrates how to work with strings. This is a basic Caesar cipher example.

var i,index:byte;
    s:string;
begin
write ('Verschiebeindex eingeben: '); readln (index);
write ('Wort eingeben: '); readln (s);
for i:=1 to length(s) do
s[i]:=chr(ord(s[i])+index);
write ('Neue String ist: ',s);
readln;
end.

Explanation[]

The indice of the cipher and the string to modify are first read from the keyboard. Then, a FOR statament passes through each of the string's chars and modifies them by adding indice to their ASCII code, thus pushing them indice chars further in the ASCII code.