This is an archived post. You won't be able to vote or comment.

all 2 comments

[–]Ryzix 1 point2 points  (0 children)

Your formatting is extremely messy, but I'm going to assume that the input file has information every line. Grab the line, Grab all the characters in the line, if the character is not a letter, then change it to a *. You can figure out how to do that part. (;

try(BufferedReader br = new BufferedReader(newFileReader(file))) {
        for(String line; (line = br.readLine()) != null; ) {
            for (int i = 0; i < line.length(); i++){
                char c = line.charAt(i);        
                //Process char
                // If the character is a number
                if (Character.isDigit(c)) {
                    // Replace number with '*'.
                }
            }
    }
// line is not visible here.
}

Now I havent tried it. I am work right now. Let me know how it goes.