---
title: "localizedStandardCompare(_:)"
framework: foundation
role: symbol
role_heading: Instance Method
path: "foundation/nsstring/localizedstandardcompare(_:)"
---

# localizedStandardCompare(_:)

Compares strings as sorted by the Finder.

## Declaration

```swift
func localizedStandardCompare(_ string: String) -> ComparisonResult
```

## Parameters

- `string`: The string to compare with the receiver.

## Return Value

Return Value The result of the comparison.

## Discussion

Discussion This method should be used whenever file names or other strings are presented in lists and tables where Finder-like sorting is appropriate. The exact sorting behavior of this method is different under different locales and may be changed in future releases. This method uses the current locale.

## See Also

### Identifying and Comparing Strings

- [caseInsensitiveCompare(_:)](foundation/nsstring/caseinsensitivecompare(_:).md)
- [localizedCaseInsensitiveCompare(_:)](foundation/nsstring/localizedcaseinsensitivecompare(_:).md)
- [compare(_:)](foundation/nsstring/compare(_:).md)
- [localizedCompare(_:)](foundation/nsstring/localizedcompare(_:).md)
- [compare(_:options:)](foundation/nsstring/compare(_:options:).md)
- [compare(_:options:range:)](foundation/nsstring/compare(_:options:range:).md)
- [compare(_:options:range:locale:)](foundation/nsstring/compare(_:options:range:locale:).md)
- [hasPrefix(_:)](foundation/nsstring/hasprefix(_:).md)
- [hasSuffix(_:)](foundation/nsstring/hassuffix(_:).md)
- [isEqual(to:)](foundation/nsstring/isequal(to:).md)
- [hash](foundation/nsstring/hash.md)
- [NSString.CompareOptions](foundation/nsstring/compareoptions.md)
- [NSString.EncodingConversionOptions](foundation/nsstring/encodingconversionoptions.md)
