let cast = ["Vivien", "Marlon", "Kim", "Karl"]
would like to return like ('% ar%')
"expected result [" Marlon "," Karl "]"
let cast = ["Vivien", "Marlon", "Kim", "Karl"]
would like to return like ('% ar%')
"expected result [" Marlon "," Karl "]"
You can use filter
of the array to do this. Here's an example:
import Foundation
let castArray = ["Vivien", "Marlon", "Kim", "Karl"]
let filtered = castArray.filter { $0.containsString("ar") }
print(filtered)
I hope I have helped. Thanks!