Search
 
SCRIPT & CODE EXAMPLE
 

SWIFT

case insensitive multiple word search swift

let filterArray = ["Big green bubble", "Red bubble", "A bubble in green", "Small green bubble", "This bubble is green"]
let textString = "green bubble".lowercased()
let words = textString.components(separatedBy: " ")
let results = filterArray.map { $0.lowercased() }.filter { string in words.allSatisfy { string.components(separatedBy: " ").contains($0) } }

print(results) /* ["Big green bubble", "A bubble in green", "Small green bubble", "This bubble is green"] */
Comment

PREVIOUS NEXT
Code Example
Swift :: ForEach tabs swiftui 
Swift :: swiftui tabview background color 
Swift :: swiftui foreach enum not all cases 
Swift :: type String and int swift addition 
Swift :: Swift Trailing Closure 
Swift :: Play Video in AVPlayer Sample Code Swift 
Swift :: undefined symbol __swift_force_load_$swift webkit react native 
Swift :: replace back button image swift 
Swift :: Swift if..else if 
Swift :: Swift Swift Function Return Values 
Swift :: fetch request core data 
Swift :: swifter apply progress bar 
Swift :: how to send a file from file manager in mail swift 
Swift :: Swift break with while Loop 
Swift :: swift how to wait in a loop 
Swift :: Swift enum With Associated Values 
Swift :: Swift is case-sensitive. So A and a are different variables 
Swift :: spacing in uitextfield 
Swift :: Rules for naming Swift Variables 
Swift :: how to switch tabs in xcode 
Swift :: uilabel without constraint 
Swift :: selenium lfor loops 
Swift :: Swift mutating Methods 
Swift :: bind object 
Swift :: Compare AnyObjects en Swift 
Swift :: flutter create custom appbar 
Ruby :: how drop model rails 
Ruby :: travis ci NameError: uninitialized constant SimpleCov 
Ruby :: ruby intersection of two arrays 
Ruby :: rails foreach 
ADD CONTENT
Topic
Content
Source link
Name
3+5 =