我使用下面的代码读取txt文件并转换为字符串
转换后,将点添加到第一行,我无法将数字字符串转换为整数
代码:
StringBuilder buf = new StringBuilder();
BufferedReader in = null;
try {
InputStream is = context.getAssets().open("db.txt");
in = new BufferedReader(new InputStreamReader(is));
String str;
while ((str = in.readLine()) != null) {
buf.append(str);
}
in.close();
Log.i("error", "" + buf.toString().trim());
}
catch (IOException e) {
e.printStackTrace();
}
错误日志: