@Test public void testGetSection() { String section = PocketTopoTxtImporter.getSection(FAKE_TEXT, "DATA"); Assert.assertEquals("1.0\t\t193.78\t0.41\t9.118\t>\n1.0\t\t328.51\t14.60\t4.709\t>", section); }
public static String getSection(String text, String header) { text = text + "\n\n"; Pattern pattern = Pattern.compile( "(?sm)" + "^" + header.toUpperCase() + "\\n" + "(.*?)\\n" + "^\\n"); Matcher matcher = pattern.matcher(text); matcher.find(); return matcher.group(1); }
PocketTopoTxtImporter extends Importer { public static String getSection(String text, String header) { text = text + "\n\n"; Pattern pattern = Pattern.compile( "(?sm)" + "^" + header.toUpperCase() + "\\n" + "(.*?)\\n" + "^\\n"); Matcher matcher = pattern.matcher(text); matcher.find(); return matcher.group(1); } }
PocketTopoTxtImporter extends Importer { public static String getSection(String text, String header) { text = text + "\n\n"; Pattern pattern = Pattern.compile( "(?sm)" + "^" + header.toUpperCase() + "\\n" + "(.*?)\\n" + "^\\n"); Matcher matcher = pattern.matcher(text); matcher.find(); return matcher.group(1); }  }
PocketTopoTxtImporter extends Importer { public static String getSection(String text, String header) { text = text + "\n\n"; Pattern pattern = Pattern.compile( "(?sm)" + "^" + header.toUpperCase() + "\\n" + "(.*?)\\n" + "^\\n"); Matcher matcher = pattern.matcher(text); matcher.find(); return matcher.group(1); }  Survey toSurvey(File file); boolean canHandleFile(File file); static String getSection(String text, String header); static Coord2D extractOffset(
            Survey survey, String text, Space<Coord2D> projection); static Coord2D getOffsetForNamedStation(String[] lines, Station station); static String getNamedSubSection(String text, String header, String sectionHeader); static String getNamedSubSection(String text, String header); static Set<PathDetail> parsePolylines(String text, Coord2D offset); static Colour interpretColour(String colourText); }
PocketTopoTxtImporter extends Importer { public static String getSection(String text, String header) { text = text + "\n\n"; Pattern pattern = Pattern.compile( "(?sm)" + "^" + header.toUpperCase() + "\\n" + "(.*?)\\n" + "^\\n"); Matcher matcher = pattern.matcher(text); matcher.find(); return matcher.group(1); }  Survey toSurvey(File file); boolean canHandleFile(File file); static String getSection(String text, String header); static Coord2D extractOffset(
            Survey survey, String text, Space<Coord2D> projection); static Coord2D getOffsetForNamedStation(String[] lines, Station station); static String getNamedSubSection(String text, String header, String sectionHeader); static String getNamedSubSection(String text, String header); static Set<PathDetail> parsePolylines(String text, Coord2D offset); static Colour interpretColour(String colourText);  }