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

Popular posts from this blog

google chrome - Developer tools - How to inspect the elements which are added momentarily (by JQuery)? -

angularjs - Showing an empty as first option in select tag -

php - Cloud9 cloud IDE and CakePHP -