You can do this with replacingOccurrences, but I found it confusing remembering which replacing functions are implemented and which ones aren't, so, here's another one.
Skip Pull Request Checklist:
- REQUIRED: I have signed the Contributor Agreement
- REQUIRED: I have tested my change locally with
swift test - OPTIONAL: I have tested my change on an iOS simulator or device
- OPTIONAL: I have tested my change on an Android emulator or device
- AI was used to generate or assist with generating this PR. Please specify below how you used AI to help you, and what steps you have taken to manually verify the changes.