diff --git a/scripts/helpers.sh b/scripts/helpers.sh index 270e688..a547e0c 100644 --- a/scripts/helpers.sh +++ b/scripts/helpers.sh @@ -61,3 +61,14 @@ battery_status() { fi fi } + +float2int() { + local float="$1" + if [[ $float =~ "," ]]; then + echo ${float%,*} + elif [[ $float =~ "." ]]; then + echo ${float%.*} + else + echo ${float//%} + fi +}