@Test public void testFindLabeledDataFromString_whenNoDelimiter_thenReturnsValue() throws Exception { Assertions.assertThat(StringParse.findLabeledDataFromString("EXTINF:", " 6: #EXTINF:9.002666, no desc")) .isEqualTo("9") ; }
public static String findLabeledDataFromString(String fieldSearch, String sData) { String value = ""; int pos = sData.indexOf(fieldSearch); if (pos != -1) { value = new Scanner(sData.substring(pos + fieldSearch.length())).useDelimiter("[^\\d]+").next(); } return value; }
StringParse implements IStringParse { public static String findLabeledDataFromString(String fieldSearch, String sData) { String value = ""; int pos = sData.indexOf(fieldSearch); if (pos != -1) { value = new Scanner(sData.substring(pos + fieldSearch.length())).useDelimiter("[^\\d]+").next(); } return value; } }
StringParse implements IStringParse { public static String findLabeledDataFromString(String fieldSearch, String sData) { String value = ""; int pos = sData.indexOf(fieldSearch); if (pos != -1) { value = new Scanner(sData.substring(pos + fieldSearch.length())).useDelimiter("[^\\d]+").next(); } return value; }  }
StringParse implements IStringParse { public static String findLabeledDataFromString(String fieldSearch, String sData) { String value = ""; int pos = sData.indexOf(fieldSearch); if (pos != -1) { value = new Scanner(sData.substring(pos + fieldSearch.length())).useDelimiter("[^\\d]+").next(); } return value; }  static Double findLabeledDoubleFromString(String fieldSearch, byte[] data); static String findLabeledDataFromString(String fieldSearch, String sData); static String findLabeledDataFromString(String fieldSearch, String delimeter, String sData); static String findLabeledDataFromString(String fieldSearch, byte[] data); static String findLabeledDataFromString(String fieldSearch, String delimeter, byte[] data); static Double findLabeledDoubleFromString(String fieldSearch, String sData); static Double findLabeledDoubleFromString(String fieldSearch, String delimeter, String sData); static Double stringToDouble(String sValue); static Double stringToDouble(String strValue, double defaultValue); static String subString(String name, char mark1, char mark2); @Override String[] parse(String targetString, String regex); @Override String[] parse(String targetString, Pattern pattern); static int[] getStringPositions(String inputStr, String matchStr); }
StringParse implements IStringParse { public static String findLabeledDataFromString(String fieldSearch, String sData) { String value = ""; int pos = sData.indexOf(fieldSearch); if (pos != -1) { value = new Scanner(sData.substring(pos + fieldSearch.length())).useDelimiter("[^\\d]+").next(); } return value; }  static Double findLabeledDoubleFromString(String fieldSearch, byte[] data); static String findLabeledDataFromString(String fieldSearch, String sData); static String findLabeledDataFromString(String fieldSearch, String delimeter, String sData); static String findLabeledDataFromString(String fieldSearch, byte[] data); static String findLabeledDataFromString(String fieldSearch, String delimeter, byte[] data); static Double findLabeledDoubleFromString(String fieldSearch, String sData); static Double findLabeledDoubleFromString(String fieldSearch, String delimeter, String sData); static Double stringToDouble(String sValue); static Double stringToDouble(String strValue, double defaultValue); static String subString(String name, char mark1, char mark2); @Override String[] parse(String targetString, String regex); @Override String[] parse(String targetString, Pattern pattern); static int[] getStringPositions(String inputStr, String matchStr);  }