From 75687711f35355bc30e4829439384aab28fcac6d Mon Sep 17 00:00:00 2001 From: href Date: Wed, 1 Sep 2021 10:30:18 +0200 Subject: Commit all the changes that hasn't been committed + updates. --- lib/util.ex | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'lib/util.ex') diff --git a/lib/util.ex b/lib/util.ex index 22d1034..d35157b 100644 --- a/lib/util.ex +++ b/lib/util.ex @@ -4,13 +4,15 @@ defmodule Util do def plusminus(0), do: "0" def plusminus(number) when number < 0, do: "#{number}" - def float_paparse(string) do + def float_paparse(float) when is_float(float), do: {float, ""} + def float_paparse(int) when is_integer(int), do: {(int+0.0), ""} + def float_paparse(string) when is_binary(string) do string |> String.replace(",", ".") |> Float.parse() end - def ets_mutate_select_each(ets, table, spec, fun) do + def ets_mutate_select_each(ets, table, spec \\ [{:"$1", [], [:"$1"]}], fun) do ets.safe_fixtable(table, true) first = ets.select(table, spec, 1) do_ets_mutate_select_each(ets, table, fun, first) -- cgit v1.2.3