java字符串函数需要帮助
System.out.println(s.toString().substring(0,s.indexOf(".mp3")));
我正在从 Android 应用程序下载文件..
我需要将它们命名为 1 2 3 这样.. 所以..我需要做的是增加它的最大大小,所以我已经完成了
System.out.println(s.toString().substring(0,s.indexOf(".mp3")));
,它会给我 1 2 3 尽管我的 mp3 文件名现在我想调整它的最大值所以我可以将其增加 1,但是该怎么做呢?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
好吧,您可以解析每个文件名(例如使用
Integer.parseInt
)。或者,如果您知道自己的文件少于(例如)100,000 个,则可以首先以可排序的方式格式化文件名 - 因此您将拥有 00141.mp3,而不是 141.mp3。这样你就可以对所有文件名进行排序并解析最后一个。
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.