Avatar ·

How to get string length in Swift? (count doesn't work like in other languages)

Hello everyone! I just started learning Swift after Python and encountered an unclear situation. In Python I used to write `len("hello")` and get 5. In Swift I tried to do this: ```swift let text = "Привет, мир!" print(text.length) ``` But Xcode gave an error: "Value of type 'String' has no member 'length'". Then I remembered that some languages use the `length` property, but in Swift it doesn't work. Then I googled that I need to use the `count` property: ```swift print(text.count) ``` But here I noticed strange behavior. If the string contains emoji or accented characters (for example, "café" or "😊"), then `count` shows something different from what I expect. For example: ```swift let emoji = "👨‍👩‍👧‍👦" print(emoji.count) // Prints 1 ``` But I expected it to be 4 (dad, mom