How can variable length strings be used in Pascal?
How can variable length strings be used in Pascal?
- Pascal can use variable length strings as it doesn’t have built in type of string and it doesn’t prevent as well if the implementation is being done without it.
- The example shows the string that is being used and initialized. This is the variable length string that is being initialized.
- The concatenation can be done after completely defining the procedures and more options can be taken on the strings.
type string = record
len: integer;
str: packed array [1..100] of char;
end;
- The operations like Find Strings, Compare and all can be taken on the string or within it.
- The initialize process is used by combining various procedures with the strings as:
var s: string;
initstr(s, 'mystring');
- Using the initstr function the exact length of the string can be found by using the blank termination.