0
Let cast = ["Vivien", "Marlon", "Kim", "Karl"]
would like to return like ('%ar%')
"result expected [ "Marlon", "Karl"] "
0
Let cast = ["Vivien", "Marlon", "Kim", "Karl"]
would like to return like ('%ar%')
"result expected [ "Marlon", "Karl"] "
0
You can use the filter
array to do this. Follow example:
import Foundation
let castArray = ["Vivien", "Marlon", "Kim", "Karl"]
let filtered = castArray.filter { $0.containsString("ar") }
print(filtered)
I hope I helped. Thanks!
Browser other questions tagged array swift filter
You are not signed in. Login or sign up in order to post.
Solved: for i in 0.. <cast.Count ː Let text = cast[i] if text.lowercased(). range(of:"ar") != nil' print(cast[i]) } }
– Rodrigo Senna