Android BufferReader

问题描述 投票:0回答:1

我有一个文本文件,当我使用Bufferedreader读取它时,它仅捕获并存储单词oshane,但我希望由缓冲区读取oshane.png。你能告诉我我做错了吗Name.txt:photo:oshane.png

这是我使用的方法

           while ((str = reader.readLine()) != null) {
               int pos = str.indexOf(":");
               String temp = str.substring(pos + 1, str.length());
               if ((str.contains("photo"))) {

                   photo = temp;
               }
java android bufferedreader
1个回答
0
投票
while ((str = reader.readLine()) != null) { name = str.split("\\:")[1]; }
© www.soinside.com 2019 - 2024. All rights reserved.