NmeaUtils { public static String cleanLine(String dataLine) { if (dataLine.startsWith("$")) { return dataLine.substring(0, Math.min(dataLine.indexOf('*') + 3, dataLine.length())); } return dataLine; }  final static boolean hasValidCheckSum(String data); static int getInt(String string); static float getFloat(String string); static float parseNmeaFormatCoordinate(String string); static String cleanLine(String dataLine);  }
@Test public void testCleanLine() { String nmeaString = "$GNGGA,223249.000,4704.833492,N,00826.465532,E,1,12,0.87,445.503,M,48.002,M,,*70BLABLABLA"; String cleaned = NmeaUtils.cleanLine(nmeaString); assertTrue(NmeaUtils.hasValidCheckSum(cleaned)); assertEquals("$GNGGA,223249.000,4704.833492,N,00826.465532,E,1,12,0.87,445.503,M,48.002,M,,*70", cleaned); }