Last active
December 28, 2015 07:29
-
-
Save AlphaFactory/7464305 to your computer and use it in GitHub Desktop.
Java Paragraph
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.io.BufferedReader; | |
import java.io.FileReader; | |
import java.io.IOException; | |
import java.util.ArrayList; | |
import java.util.regex.Matcher; | |
import java.util.regex.Pattern; | |
public class start | |
{ | |
public static void main(String[] args) | |
{ | |
ArrayList<String> lines = new ArrayList<String>(); | |
try | |
{ | |
BufferedReader in = new BufferedReader(new FileReader(args[0])); | |
String s; | |
StringBuilder sb = new StringBuilder(); | |
while ((s = in.readLine()) != null) | |
{ | |
sb.append(s + "\n"); | |
} | |
in.close(); | |
String pattern = "([^\\.]+)\\n"; | |
//"(\\.|」|\")(\\s){1,}\n"; | |
Pattern p = Pattern.compile(pattern); | |
Matcher m = p.matcher(sb); | |
while (m.find()) | |
{ | |
m.replaceAll("$1"); | |
} | |
System.out.println(sb.toString()); | |
} catch (IOException e) | |
{ | |
System.err.println(e); | |
System.exit(1); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment