**tl;dr** If you want the length of a String type in terms of the number of human-readable characters, use **countElements()**. If you want to know the length in terms of the number of *extended grapheme clusters*, use **endIndex**. Read on for details.
The **String** type is implemented as an ordered collection (i.e., sequence) of Unicode characters, and it conforms to the **CollectionType** protocol, which conforms to the **_CollectionType** protocol, which is the input type expected by **countElements()**. Therefore, **countElements()** can be called, passing a **String** type, and it will return the count of characters.
However, in conforming to **CollectionType**, which in turn conforms to **_CollectionType**, **String** also implements the **startIndex** and **endIndex** computed properties, which actually represent the position of the index *before* the first character cluster, and position of the index *after* the last character cluster, respectively. So, in the string "ABC", the position of the index before A is 0 and after C is 3. Therefore, **endIndex** = 3, which is also the length of the string.
So, **endIndex** can be used to get the length of any String type, then, right?
Well, not always...Unicode characters are actually *extended grapheme clusters*, which are sequences of one *or more* Unicode scalars combined to create a single human-readable character.
let circledStar: Character = "\u{2606}\u{20DD}" // ☆⃝
**circledStar** is a single character made up of U+2606 (a white star), and U+20DD (a combining enclosing circle). Let's create a **String** from **circledStar** and compare the results of **countElements()** and **endIndex**.
let circledStarString = "\(circledStar)"
countElements(circledStarString) // 1
circledStarString.endIndex // 2