How to capitalize only the first letter of a string in Swift?
Hello everyone! I recently started learning Swift and encountered this problem. I need to transform a string so that the first letter is uppercase and all the rest are lowercase. For example, from the string "hello WORLD" it should become "Hello world". \n\nI know there is the `.uppercased()` method for the entire string and `.lowercased()` for converting to lowercase, but how do I apply them only to the first letter? \n\nI tried this code:\n```swift\nlet str = "hello WORLD"\nlet firstLetter = str.prefix(1).uppercased()\nlet rest = str.dropFirst().lowercased()\nlet result = firstLetter + rest\nprint(result) // "Hello world"\n```\nIt seems to work, but I'm not sure if this is the right approach. Is there a more elegant way? Maybe Swift has a special method for this? \n\nThe question came up when I was writing a pr