Substring.StartsWithAscii Method

function StartsWithAscii(const Value: string; const IgnoreCase: Boolean): Boolean; overload;

Whether the text starts with Value, ignoring case when IgnoreCase is True for A to Z only: A to Z and a to z match each other, every other character only itself; ordinal when it is False.

#NameTypeDescription
1Valuestring
2IgnoreCaseBoolean

Returns: Boolean

Remarks:

Every text kind.
Note: This routine handles only ANSI/ASCII case char mapping and does not handle locale specific char handling, but it is 5.4 to 91 times faster than its StartsWithLinguistic alternative.

Examples

A prefix in another case.

uses Substr;

procedure Example;
begin
    Assert(Substring('Hello').StartsWithAscii('he', True));
    Assert(not Substring('Hello').StartsWithAscii('he', False));
end;