我想知道如何将字符串值与.txt文件的每一行进行比较,并获得相同的值。Android - 将原始文件夹中的.txt文件与字符串进行比较
我从.txt文件获得所有值,但我不明白如何比较它。 例如
ABC
CBA
CCC
都在我的.txt文件, 和我的活动
String someText = "ABC";
以及如何将其与.txt文件eacline比较。 我在代码下面做了.txt文件的值。
String result;
try {
Resources res = getResources();
InputStream in_s = res.openRawResource(R.raw.out);
byte[] b = new byte[in_s.available()];
in_s.read(b);
result = new String(b);
tx.setText(result);
} catch (Exception e) {
// e.printStackTrace();
result = "Error: can't show file.";
tx.setText(result);
}