我想检查我的SD卡根目录中以“thisfile”开头的文件并返回int或字符串中的文件数量。检查以字符串开头的文件数
,比如我有我的SD卡上的10个文件,名称如下:
thisfile1.txt
thisfile444.txt
thisfileffvdfv.txt
thisfilefdfvdfv.txt
thisfile4fvdfv.txt
thisfilefvdfvdf.txt
thisfiledfvdfvdfv.txt
thisfilefdvdfvdf.txt
thisfilewedwed.txt
thisfilewedwedfff.txt
在这个例子中,我希望我的代码返回10本。
有人可以帮忙吗?
这很接近,但它可能会返回误报 - 如果'cs'在'String'对象中但不在开头,它仍然会返回true。 – edthethird 2012-03-23 16:52:53
是的,我读得太快了,没有注意到子字符串必须位于文件名的开头。 – 2012-03-23 21:05:46