---
title: count
framework: swift
role: symbol
role_heading: Instance Property
path: swift/string/count
---

# count

The number of characters in a string.

## Declaration

```swift
var count: Int { get }
```

## Discussion

Discussion To check whether a string is empty, use its isEmpty property instead of comparing count to zero. note: O(n), where n is the length of the string.

## See Also

### Inspecting a String

- [isEmpty](swift/string/isempty.md)
