Articles, podcasts and news about Swift development, by John Sundell.

Character category properties

Published on 23 Jul 2019
Basics article available: Strings

I absolutely love the many different category properties that were added to Swift’s Character type as part of Swift 5.0. I’ve been writing a ton of string parsing code lately, and these properties have been so incredibly useful.

let character: Character = "A"

character.isLetter // true
character.isNumber // false
character.isUppercase // true
character.isSymbol // false
character.isCurrencySymbol // false
character.isASCII // true

Support Swift by Sundell by checking out this sponsor:

Emerge

Emerge: Continuously monitor and reduce your app’s size. Emerge’s easy to use plugins for GitHub and fastlane will automatically scan your app’s binary and provide you with simple, actionable suggestions on how to make it smaller and, in turn, faster for your users to download. Set up a demo now!