I've got a txt file with following contents:
abc
I made the file with Notepad and saved it in UTF-8. Calling the following function with "abc"
from Scala Interpreter yields false
The function searches the txt file with the string+final character of file.
def isWordKnown(word: String):Boolean={
val inputStreamFromKnownWordsList=new FileInputStream("D:\\WordTracker\\new english\\test.txt")
var stringWriter=new StringWriter()
IOUtils.copy(inputStreamFromKnownWordsList,stringWriter,"UTF-8")
val knownWordsString=stringWriter.toString()
val endOfLine=knownWordsString.substring(knownWordsString.length()-1, knownWordsString.length())
return knownWordsString.contains(word+endOfLine)
}