Numbers { @UserFunction("apoc.number.parseFloat") @Description("apoc.number.parseFloat(text) | parse a text using the default system pattern and language to produce a double") public Double parseFloat(final @Name("text") String text, @Name(value = "pattern",defaultValue = "") String pattern, @Name(value = "lang",defaultValue = "") String lang) { Number res = parseNumber(text, pattern, lang); return res == null ? null : res.doubleValue(); }  @UserFunction @Description("apoc.number.format(number) | format a long or double using the default system pattern and language to produce a string") String format(final @Name("number") Object value,@Name(value = "pattern",defaultValue = "") String pattern, @Name(value = "lang", defaultValue = "") String lang); @UserFunction("apoc.number.parseInt") @Description("apoc.number.parseInt(text) | parse a text using the default system pattern and language to produce a long") Long parseInt(final @Name("text") String text, @Name(value = "pattern",defaultValue = "") String pattern, @Name(value = "lang",defaultValue = "") String lang); @UserFunction("apoc.number.parseFloat") @Description("apoc.number.parseFloat(text) | parse a text using the default system pattern and language to produce a double") Double parseFloat(final @Name("text") String text, @Name(value = "pattern",defaultValue = "") String pattern, @Name(value = "lang",defaultValue = "") String lang);  }
@Test public void testParseFloat() throws Exception { testCall(db, "RETURN apoc.number.parseFloat('12,345.67') AS value", row -> assertEquals(new Double(12345.67), row.get("value"))); testCall(db, "RETURN apoc.number.parseFloat('12.345,67', '', 'it') AS value", row -> assertEquals(new Double(12345.67), row.get("value"))); testCall(db, "RETURN apoc.number.parseFloat('12,345.67', '#,##0.00;(#,##0.00)') AS value", row -> assertEquals(new Double(12345.67), row.get("value"))); testCall(db, "RETURN apoc.number.parseFloat('12.345,67', '#,##0.00;(#,##0.00)', 'it') AS value", row -> assertEquals(new Double(12345.67), row.get("value"))); testCall(db, "RETURN apoc.number.parseFloat('aaa') AS value", row -> assertEquals(null, row.get("value"))); }