System.SysUtils.TStringHelper.CountChar
Delphi
function CountChar(const C: Char): Integer;
プロパティ
種類 | 可視性 | ソース | ユニット | 親 |
---|---|---|---|---|
function | public | System.SysUtils.pas | System.SysUtils | TStringHelper |
説明
CountChar は、文字列の中に文字 C
が出てくる回数をカウントします。
例
以下のコードは、文字列内の文字 "s" をカウントします。
const
myString = 'This string contains 5 occurrences of s';
begin
writeln(myString.CountChar('s'));
readln;
end.