# Compare()

Performs a case-sensitive comparison of two strings. Returns:

* `-1` if string1 is *less than* string2
* `0` if string1 is *equal to* string2
* `1` if string1 is *greater than* string2

```
Compare( string1=string, string2=string );
```

**Returns:** number

# Arguments

| Argument | Type | Required | Description | Default |
|----------|------|----------|-------------|---------|
| string1 | string | Yes | A string or a variable that contains one |  |
| string2 | string | Yes | A string or a variable that contains one |  |

# Examples

```cfml
dump(Compare("100 Main St.", "675 East Avenue")); // -1
dump(Compare("500 Main St.", "1 Cupertino Way")); // 1
dump(Compare("500 Main St.", "500 Main St."));//0
```







# Categories

[Strings](../../categories/string.md)

# See Also

[string.compare()](../objects/string/compare.md)