.count / .uppercased()
Try it yourself →Length and case conversion.
Syntax
text.count // text.uppercased()
Description
count gives the number of characters (not length!). uppercased converts to uppercase, lowercased to lowercase (returns new text).
Example
let s = "HexLibrary" print(s.count) print(s.uppercased()) print(s.lowercased())
Expected output
10 HEXLIBRARY hexlibrary
When to use?
Input validation, case-insensitive comparison.
Common mistakes
- ⚠️ Length is determined by .count, not .length.