High-level Programming Language (Pascal)
Basic Operations on Strings
Assignment
¡@Name := 'Chan Tai Man';
¡@Class := 'F4A';
¡@Address := 'Rm 5, 20 / F, 108 School Road, Hong Kong.';
Input/Output
for example,
¡@readln (Name);
¡@readln (Class);
Accessing individual characters of a string
Comparison
for example,
¡@'G' is greater than 'A'
¡@since the ASCII value of the letter 'G' is 71 and that of 'A' is 65
for example,
¡@'GRAPES' > 'APPLE' is true because 'G' follows 'A'
¡@'Computers' < 'Computing' is true because 'e' precedes 'i'
for example,
'DAVID' is less than 'David', because 'A' is less than 'a'
for example,
'computer' is less than 'computer' because the blank space comes before the letter 'c' in the ASCII table
'computer' is greater than the string 'computer' because the former one is longer
Initialization of string variable