iOS Swift: Check string suffix -
i have array of strings filenames in app bundle. pngs others movs. there method checking string suffix in swift?
use hassuffix
, filter
methods, this:
let files : [string] = ["quick.txt", "brown.mov", "fox.exe", "jumps.mov", "over.jpg", "the.txt", "lazy.mov", "dog.opt"] let movs = files.filter{$0.hassuffix(".mov")} println(movs) // prints [brown.mov, jumps.mov, lazy.mov]
Comments
Post a Comment