[Overview][Constants][Types][Classes][Procedures and functions][Variables][Index] | Reference for unit 'sysutils' (#rtl)

# stricomp

Compare 2 null-terminated strings, case insensitive.

## Declaration

Source position: syspchh.inc line 26

`function stricomp(`
`str1: pchar;`
`str2: pchar`
`):SizeInt; function stricomp(`
`str1: pwidechar;`
`str2: pwidechar`
`):SizeInt;`

## Description

Compares the null-terminated strings S1 and S2, ignoring case. The result is

- A negative Longint when S1<S2.
- 0 when S1=S2.
- A positive Longint when S1>S2.

## Errors

None.

## See also

StrLComp |  | Compare limited number of characters of 2 null-terminated strings
StrComp |  | Compare 2 null-terminated strings, case sensitive.
StrLIComp |  | Compare limited number of characters in 2 null-terminated strings, ignoring case.

## Example

    Program Example8;

    Uses strings;

    { Program to demonstrate the StrLComp function. }

    Const P1 : PChar = 'This is the first string.';
          P2 : PCHar = 'This is the second string.';

    Var L : Longint;

    begin
      Write ('P1 and P2 are ');
      If StrComp (P1,P2)<>0 then write ('NOT ');
      write ('equal. The first ');
      L:=1;
      While StrLComp(P1,P2,L)=0 do inc (L);
      dec(l);
      Writeln (l,' characters are the same.');
    end.