String STR="";
The File outcontent=new File (" F: "+ File. The separator +" example. TXT ");
FileInputStream in=new FileInputStream (outcontent);
Int size=in. The available ();
Byte [] buffer=new byte [size];
In the read (buffer);
In the close ();
STR=new String (buffer);
One example. TXT file including line breaks
If at the end of the program to join
STR=STR. Replace (" \ n ", "");
The last line in the STR \ n and its characters are not before the
Excuse me how can I replace a newline right and will not affect the other characters, beg bosses to disabuse
CodePudding user response:
Use the subString method remove the last character and emptyCodePudding user response: