Extra space when looping through text file.

By PierceJ

When looping through a text file with each item on a different line, the loop keeps getting an extra white space as one of the values.

try {
            BufferedReader br = new BufferedReader(new FileReader("Words.txt"));
            String line;
            while ((line = br.readLine()) != null) {
                event.getTextChannel().sendMessage(line + "; ").queue();
            }
            br.close();
    }

The result I’m getting is:

廊下;

;

火星;

;

意味;

;

but I want 廊下; 火星; 意味;

Source: Stack Overflow

    

Share it with your friends!

    Fatal error: Uncaught Exception: 12: REST API is deprecated for versions v2.1 and higher (12) thrown in /home/content/19/9652219/html/wp-content/plugins/seo-facebook-comments/facebook/base_facebook.php on line 1273