In Pascal, to replace one substring with another in a string, use the stringReplace():
method
stringReplace(original, old, new, flag): originalString substring old is replaced on new, flag is one of the rfReplaceAll or rfIgnoreCase, values written to square brackets. In the first case, all occurrences of old into originalString, in the second, only the first.
Pascal string substitution example:
phone = '+1-234-567-89-10'
// hyphens are changed to spaces
edited_phone := stringreplace(phone, '-', ' ', [rfReplaceAll]);
writeln(edited_phone); // +1 234 567 89 10
// hyphens are removed
edited_phone := stringreplace(phone, '-', '', [rfReplaceAll]);
writeln(edited_phone); // +12345678910
// only the first dash changes
edited_phone := replace(phone, '-', '', [rfIgnoreCase]);
writeln(edited_phone); // +1234-567-89-10