newline - How can I handle invisible new line characters in Java? -



newline - How can I handle invisible new line characters in Java? -

i working on code game in java. supposed fill array characters .txt file. problem programm stores invisible new line characters file , result array not filled correctly. have tried replace invisible characters result disastrous (my array filled first line , rest remain empty) here block of code used array:

import java.util.*; import java.io.*; public class test { public static void main(string[] args) throws ioexception{ char background[][] = new char [14][20]; seek { fileinputstream fileinput = new fileinputstream("background.txt"); int r; for(int i=0;i<14;i++){ for(int j=0;j<20;j++){//<<this line changed while((r = fileinput.read()) != -1){ char c = (char) r; background[i][j] = c; break; } } } fileinput.close(); } grab (filenotfoundexception e) { // todo auto-generated grab block e.printstacktrace(); } (int i=0;i<14;i++){ for(int j=0;j<20;j++){ system.out.print(background[i][j]); } } } }

also format of .txt file can found here: http://pastebin.com/nynjgkfk. lot in advance!

read line string, phone call .trim() method on line, , utilize .tochararray() split chars.

java newline invisible character-arrays

Comments

Popular posts from this blog

php - Android app custom user registration and login with cookie using facebook sdk -

django - Access session in user model .save() -

php - .htaccess Multiple Rewrite Rules / Prioritizing -