how to check how many file names start with certain chars?
I have an iphone app that saves some people's data on a single file. Each filename is represented by the user name plus an incremental number, say "tommy1", "tommy2",... , "tommy32", then "sarah1", "sarah2", and so on.
Is it possible to count how many of them are "tommy"'s and how many are "sarah"'s from with开发者_如何学Cin the code ? thanks
-[NSFileManager contentsOfDirectoryAtPath:error:]
and
-[NSString hasPrefix:]
and perhaps NSCountedSet.
精彩评论