Fix to allow negative Values
This commit is contained in:
parent
ad1fddf495
commit
7501cf7781
@ -9,12 +9,21 @@ import Http exposing (..)
|
||||
-- Please note that only 0 are added. The number will not be shortend!
|
||||
addLeadingZero : Int -> Int -> String
|
||||
addLeadingZero number length =
|
||||
if number >= 0 then
|
||||
let
|
||||
num_str = String.fromInt number
|
||||
in
|
||||
(String.fromList <| List.repeat (length - String.length num_str) '0'
|
||||
)
|
||||
++ num_str
|
||||
else
|
||||
let
|
||||
num_str = String.fromInt <| 0-number
|
||||
in
|
||||
"-" ++
|
||||
(String.fromList <| List.repeat (length - String.length num_str) '0'
|
||||
)
|
||||
++ num_str
|
||||
|
||||
|
||||
-- Get the value at a given position in a List.
|
||||
|
Loading…
x
Reference in New Issue
Block a user