How to check if a string starts with a specified substring in Pascal

1 Answer

0 votes
program StringStartsWithSubstring;

var
  str, substr: string;

begin
  str := 'Pascal Programming Language';
  substr := 'Pascal';

  if Pos(substr, str) = 1 then
    writeln('yes')
  else
    writeln('no');
end.



(*
run:

Pascal

*)

 



answered Feb 10, 2025 by avibootz
...