Numbers { @UserFunction("apoc.number.parseInt") @Description("apoc.number.parseInt(text) | parse a text using the default system pattern and language to produce a long") public Long parseInt(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.longValue(); }  @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 testParseInt() throws Exception { testCall(db, "RETURN apoc.number.parseInt('12,345') AS value", row -> assertEquals(new Long(12345), row.get("value"))); testCall(db, "RETURN apoc.number.parseInt('12.345', '' ,'it') AS value", row -> assertEquals(new Long(12345), row.get("value"))); testCall(db, "RETURN apoc.number.parseInt('12,345', '#,##0.00;(#,##0.00)') AS value", row -> assertEquals(new Long(12345), row.get("value"))); testCall(db, "RETURN apoc.number.parseInt('12.345', '#,##0.00;(#,##0.00)', 'it') AS value", row -> assertEquals(new Long(12345), row.get("value"))); testCall(db, "RETURN apoc.number.parseInt('aaa') AS value", row -> assertEquals(null, row.get("value"))); }