number of characters of string in pascal

Pascal: Number of Characters in a String

To determine the number of characters in a string in Pascal, you can use the Length function. The Length function returns the number of characters in a string.

Here's an example of how to use the Length function in Pascal:

program CountCharacters;
var
  str: string;
  count: integer;
begin
  str := 'Hello, World!';
  count := Length(str);
  writeln('Number of characters: ', count);
end.

In this example, the str variable is assigned the value "Hello, World!". The Length function is then used to determine the number of characters in the string, and the result is stored in the count variable. Finally, the result is displayed using the writeln function.

The output of this program will be:

Number of characters: 13

So, in Pascal, the Length function can be used to find the number of characters in a string.