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

# TStringHelper.CompareOrdinal

Compare 2 strings byte for byte

## Declaration

Source position: syshelph.inc line 73

`public class function TStringHelper.CompareOrdinal(`
`const A: string;`
`const B: string`
`):Integer; overload; class function TStringHelper.CompareOrdinal(`
`const A: string;`
`IndexA: SizeInt;`
`const B: string;`
`IndexB: SizeInt;`
`ALen: SizeInt`
`):Integer; overload;`

## Description

CompareOrdinal compares 2 strings A and B bytewise. It is faster than a regular compare, but offers less options.

- 0 if the strings are equal
- a negative number if A < B
- a positive number if A > B

Optionally, a zero-based starting index for the compare can be given for each of the strings: IndexA and IndexB. In this case a maximum amount of characters (ALen) to be compared must also be specified.

## Errors

None.

## See also

TStringHelper.Compare |  | Compare 2 strings
TStringHelper.CompareTo |  | Compare string to another