Sign in Join
FPDoc Onlineexperiment

LazStartsText function

In unit LazStringUtils

Determines if a string occurs at the beginning of the specified text.

Declaration

pascal
function LazStartsText(const ASubText: string; const AText: string)
: Boolean

Arguments

ASubText

Value to locate at the start of the string.

AText

String value used in the comparison.

Function result

True when the sub-text is at the start of the string value.

Description

LazStartsText is a fast implementation of StartsText. The version in the RTL strutils.pp unit calls AnsiCompareText and is very slow.

LazStartsText casts the values in ASubText and AText to PChar types, and calls StrLIComp to perform a case-insensitive comparison for the number of characters in ASubText.

The return value is True when ASubText and AText start with the same values. The return value is also True when ASubText is an empty string (''); this is Delphi compatible. The return value is False when StrLIComp returns a non-zero value.

See also

An experiment, built from development snapshots. Not the official Free Pascal or Lazarus documentation.