Home > General > String Manipulation

String Manipulation

program stringss;

uses
    wincrt;
var
   s          : string;

   l,p        : integer;
   s1,s2,s3   : string; 

begin

  s := 'This is a string';
  writeln( s );
  writeln; 

  l := length(s); {Find length of a string}
  writeln('String length: ', l); {16}

  p := pos('This',s); {find position of text in a string}
  writeln('Position of ''This'': ', p); {1}
  writeln; 

  (***** "Join" together strings to create one big string *****)
  s1 := 'This';
   s2 := ' is a ';
    s3 := 'string.';
     writeln( concat(s1,s2,s3) ); {This is a string.}

end.
Categories: General Tags:
  1. No comments yet.
  1. No trackbacks yet.