怎么得到一个数组中指定的字符串?

allanence 2012-06-28 02:39:00
/mnt/sdcard/VideosZip/1339730718.wmv, /mnt/sdcard/VideosZip/list.xml 前面是一个数组里面的数据,我得到/mnt/sdcard/VideosZip/list.xml 这个字符。还有我不知道我要得到的字符在数组中位置?
...全文
126 14 打赏 收藏 转发到动态 举报
写回复
用AI写文章
14 条回复
切换为时间正序
请发表友善的回复…
发表回复
fannifan 2012-06-28
  • 打赏
  • 举报
回复
也可以用分割的办法。。。。
allanence 2012-06-28
  • 打赏
  • 举报
回复
谢谢各位啦,我使用的是这个endsWith(".xml")!
bowang_dayi 2012-06-28
  • 打赏
  • 举报
回复
[Quote=引用 10 楼 的回复:]

引用 9 楼 的回复:

遍历了得到了两个字符串/mnt/sdcard/VideosZip/1339730718.wmv,和/mnt/sdcard/VideosZip/list.xml ,那我改怎么判断得到.xml文件?


直接取最后3个substring看是否equals(xml),最原始的办法
[/Quote]

嗯,是的!
  • 打赏
  • 举报
回复
遍历后进行equals比较
dinko321 2012-06-28
  • 打赏
  • 举报
回复
[Quote=引用 9 楼 的回复:]

遍历了得到了两个字符串/mnt/sdcard/VideosZip/1339730718.wmv,和/mnt/sdcard/VideosZip/list.xml ,那我改怎么判断得到.xml文件?
[/Quote]

直接取最后3个substring看是否equals(xml),最原始的办法
allanence 2012-06-28
  • 打赏
  • 举报
回复
遍历了得到了两个字符串/mnt/sdcard/VideosZip/1339730718.wmv,和/mnt/sdcard/VideosZip/list.xml ,那我改怎么判断得到.xml文件?
allanence 2012-06-28
  • 打赏
  • 举报
回复
怎么遍历得到.xml结尾的字符串!??
bowang_dayi 2012-06-28
  • 打赏
  • 举报
回复
你是想问怎么使遍历的效率高些?还是想问除了遍历有没有其它算法可以打到以 .xml 结尾的字符串?
bowang_dayi 2012-06-28
  • 打赏
  • 举报
回复
数组的每个元素都要遍历的吧,不然怎么知道.xml呢
hellonihao100 2012-06-28
  • 打赏
  • 举报
回复
什么意思啊
dinko321 2012-06-28
  • 打赏
  • 举报
回复
意思是一个数组
String[] s = {/mnt/sdcard/VideosZip/1339730718.wmv, /mnt/sdcard/VideosZip/list.xml}

然后你要得到以 .xml 结尾的字符串?


除了遍历我觉得无解
KPRF2009 2012-06-28
  • 打赏
  • 举报
回复
没看懂。。。帮顶
allanence 2012-06-28
  • 打赏
  • 举报
回复
我要得到/mnt/sdcard/VideosZip/list.xml 。
developer 2012-06-28
  • 打赏
  • 举报
回复
你要得到什么

80,360

社区成员

发帖
与我相关
我的任务
社区描述
移动平台 Android
androidandroid-studioandroidx 技术论坛(原bbs)
社区管理员
  • Android
  • yechaoa
  • 失落夏天
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧