pascalabcnet/TestSuite/CompilationSamples/StringMethods2.pas
Бондарев Иван e6e67c193c initial commit
2015-05-14 21:35:07 +02:00

37 lines
721 B
ObjectPascal
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

var s1,s2: string;
begin
// Извлечение подстрок
s1 := 'ABCDEFGH';
s2 := s1.Substring( ачальная_позиция = } 3);
Writeln(s2);
s2 := s1.Substring(3, {длина_подстроки = } 2);
Writeln(s2);
// Вставка, удаление и замена подстрок
s1 := 'ABCDEFGH';
s2 := s1.Insert(2, 'xxx');
Writeln(s2);
s2 := s2.Replace('x', '!');
Writeln(s2);
s2 := s2.Remove(2, 3);
Writeln(s2);
s1 := 'слово слово слово';
s2 := s1.Replace('слов', 'молок');
Writeln(s2);
// Удаление пробельных символов в концах строки
s1 := ' xxx xxx ';
Writeln('|', s1, '|');
s1 := s1.Trim;
Writeln('|', s1, '|');
// Смена регистра символов
s1 := 'абвгд';
s1 := s1.ToUpper;
Writeln(s1);
end.