Disclaimer: This question pertains to homework. I've been trying this for a little bit now and I've taken out most the stuff I've tried because it's just become redundant.My question is how do I count the number of "lines" in my file that have non ascii characters. I've found the way to count how many non-ascii characters occur. The line is stumping me though.
For instance, if a line in the file reads èèèèè, then movieCount should increase by 1 and my ascCount should increase by 5. Not all lines will have non-ascii characters though.
public static void main(String [] args) throws FileNotFoundException{
//open the file
File movieFile = new File("/home/turing/t90rkf1/d470/dhw/hw5-movies/movie-names.txt");
InputStream file = new FileInputStream(movieFile);
String empty = null;
int movieCount = 0;
int ascCount = 0;
try {
FileReader readFile = new FileReader(movieFile);
BufferedReader buffMovie = new BufferedReader(readFile);
//read while stream is not empty
while ((empty = buffMovie.readLine()) != null){
//check the value for ascii
for(int j = 0, n = empty.length(); j < n; j++){
char asc = empty.charAt(j);
if( asc > 127 ){
ascCount++;
}
}
}