How to remove leading and trailing whitespaces from a string in Pascal

1 Answer

0 votes
program StringTrimLength;

uses 
  SysUtils; // Trim

var
  s: string;

begin
  s := '         pascal python java php c c++    ';
  
  WriteLn(Length(s));

  s := Trim(s);

  WriteLn(Length(s));

  WriteLn(s);
end.




(*
run:
  
41
28
pascal python java php c c++
  
*)

 



answered Jul 26 by avibootz
...