v2 / vlib / v / slow_tests / valgrind / multiple_fn_calls.v
13 lines · 11 sloc · 357 bytes · c48ae86132e246aa5c34226fecac9848160973c5
Raw
1import strconv
2
3fn color_code_to_rgb(color string) []int {
4 clr := color.replace('#', '')
5 return [int(strconv.parse_int(clr[0..2], 16, 0) or { return [0, 0, 0] }),
6 int(strconv.parse_int(clr[2..4], 16, 0) or { return [0, 0, 0] }),
7 int(strconv.parse_int(clr[4..6],
8 16, 0) or { return [0, 0, 0] })]
9}
10
11fn main() {
12 dump(color_code_to_rgb('#abcdef'))
13}
14