You can do it this way:
let myString = "so123han"
let alphaChars = myString.unicodeScalars.filter({ CharacterSet.letters.contains($0) }).map({ Character($0) })
More Related Contents:
- Read and write a String from text file
- How to convert Data to hex string in swift
- AlamoFire GET api request not working as expected
- Best practice to implement a failable initializer in Swift
- How to Convert UNIX epoch time to Date and time in ios swift
- Dynamically hiding view in SwiftUI
- Property getters and setters
- How to compare one value against multiple values – Swift
- Getting keyboard size from userInfo in Swift
- How to create array of unique object list in Swift
- What is _: in Swift telling me?
- Swift random float between 0 and 1
- What is Geometry Reader in SwiftUI?
- SwiftUI dismiss modal
- Number of words in a Swift String for word count calculation
- How do I make a custom initializer for a UIViewController subclass in Swift?
- Deinit never called
- How to convert a base64String to String in Swift?
- Generic function taking a type name in Swift
- How to multiply two arrays element-wise
- Creating json in swift
- Why my return is nil but if i press the url in chrome/safari, i can get data?
- Extra arguments at positions #11, #12 in call SwiftUI [duplicate]
- How can I get text to wrap in a UILabel (via UIViewRepresentable) without having a fixed width?
- Where is Info.plist in Xcode 13? (missing, not inside project navigator)
- Swift closure async order of execution
- How to convert hex number to bin in Swift?
- Projecting the ARKit face tracking 3D mesh to 2D image coordinates
- What is the reduce() function doing, in Swift
- Core Data Predicate Filter By Today’s Date