RosettaCodeData/Task/Copy-a-string/Pascal/copy-a-string.pas

17 lines
661 B
ObjectPascal
Raw Permalink Normal View History

2024-03-06 22:25:12 -08:00
program copyAString;
var
{ The Extended Pascal `string` schema data type
is essentially a `packed array[1..capacity] of char`. }
source, destination: string(80);
begin
source := 'Hello world!';
{ In Pascal _whole_ array data type values can be copied by assignment. }
destination := source;
{ Provided `source` is a _non-empty_ string value
you can copy in Extended Pascal sub-ranges _of_ _string_ types, too.
Note, the sub-range notation is not permitted for a `bindable` data type. }
destination := source[1..length(source)];
{ You can also employ Extended Pascals `writeStr` routine: }
writeStr(destination, source);
end.