开发者

java string function need help

System.out.println(s.toString().substring(0,s.indexOf(".mp3")));

i am downloading file from android application..

i need to name them as 1 2 3 like that.. so.. i'll need to do is increment the max size of it so i've开发者_运维知识库 done the

System.out.println(s.toString().substring(0,s.indexOf(".mp3")));

from this it will give me 1 2 3 that is spite my mp3 file name now i want to fine max of it so i can increment it by 1 but how to do this?


Well, you could parse each filename (e.g. using Integer.parseInt).

Alternatively, if you knew you'd have less than (say) 100,000 files, you could format the filenames in a sortable fashion to start with - so instead of 141.mp3, you'd have 00141.mp3. That way you could just sort all the filenames and parse the last one.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜