Click here to Skip to main content
15,867,330 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
public class Compress
{
public static void main( String[] args ) throws FileNotFoundException
{
File file = new File("E:\\input.txt");
Scanner scanner = new Scanner(file);
PrintWriter writer = new PrintWriter("E:\\sample.txt");

while(scanner.hasNextLine()){
String line = scanner.nextLine();

String newLine = "";

for(int i=0; i<line.length();> if(line.charAt(i) != '\n'){
newLine += line.charAt(i);
}
}
}
}
}

What I have tried:

"purus ante non libero.
Nullaacaugue ut odioeleifend
interdueuveurnpulvinaarcpretium"

I want to this paragraph into one line sentence like this following.

"purus ante non libero.Nullaacaugue ut odioeleifend interdueuveurnpulvinaarcpretium"
Posted
Updated 28-Jul-16 18:59pm

1 solution

 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900