[Overview][Constants][Types][Procedures and functions][Index] |
A case-insensitive optimized version of the Pos routine.
Source position: lazstringutils.pas line 44
function PosI( |
const SubStr: string; |
const S: string |
):Integer; |
SubStr |
|
Value to locate in the searched value. |
S |
|
Value searched for the specified sub-string. |
Position of the sub-string within the searched value, or 0 when not found.
PosI implements a case-insensitive optimized version of the Pos routine found the RTL system unit. It only accepts String values in its parameters, unlike the RTL overloaded variants which accept combinations of the Char, ShortString, AnsiString, UnicodeString, WideString, and Variant types.
It is also an alternative to the ContainsText routine in the RTL StrUtils unit, which has a very slow implementation.
SubStr contains the value to locate in S.
PosI supports ASCII comparison. It converts the values in SubStr and S to lowercase char by char for fast comparisons. The result is much faster than Pos(Lowercase(SubStr),Lowercase(S)) which is often used.
The return value contains the position in S where SubStr is located, or 0 when SubStr does not occur in S. The position is 1-based just like indexed access to values in the String type.
Version 4.0 | Generated 2025-05-03 | Home |