I have a Swift based iOS app and one of the features allows you to comment on a post. Anyway, users can add "@mentions" in their posts to tag other people. However I want to stop the user from adding a username with a capital letter.
Is there anyway I can convert a string, so that the @usernames are all in lowercase?
For example:
I really enjoy sightseeing with @uSerABC (not allowed)
I really enjoy sightseeing with @userabc (allowed)
I know there is a property for the string in swift called .lowercaseString
- but the problem with that, is that it makes the entire string lowercase and thats not what I want. I only want the @username to be in lower case.
Is there any way around this with having to use the .lowercase
property.
Thanks for your time, Dan.