System.SysUtils.TStringHelper.CountChar

From RAD Studio API Documentation
Jump to: navigation, search

Delphi

function CountChar(const C: Char): Integer;

Properties

Type Visibility Source Unit Parent
function public System.SysUtils.pas System.SysUtils TStringHelper

Description

CountChar counts the occurrences of the C character in the string.

Example

The following code counts the "s" letters in the string:

const
  myString = 'This string contains 5 occurrences of s';
begin
  writeln(myString.CountChar('s'));
  readln;
end.

See Also