Compare commits

..

No commits in common. "53a0d77ecb5f82c49403e686d3adb190dd1e147b" and "8dc59e114c3c62083fb99c54a4b5f1b9c92de6c8" have entirely different histories.

2 changed files with 3 additions and 3 deletions

View File

@ -18,8 +18,8 @@ fn (m Memory) mib() f64 {
fn Memory.from_string(s string) !Memory { fn Memory.from_string(s string) !Memory {
mut re := regex.regex_opt(r'^(\d+)([a-zA-Z]+)$')! mut re := regex.regex_opt(r'^(\d+)([a-zA-Z]+)$')!
re.match_string(s) re.match_string(s)
if re.groups.len != 2 { if re.groups.len < 2 {
return error("unable to parse string '${s}'") return error('unable to parse string ${s}')
} }
value := re.get_group_by_id(s, 0).f64() value := re.get_group_by_id(s, 0).f64()
unit := dataunits.from_string(re.get_group_by_id(s, 1))! unit := dataunits.from_string(re.get_group_by_id(s, 1))!

2
v.mod
View File

@ -1,7 +1,7 @@
Module { Module {
name: 'dataunits' name: 'dataunits'
description: 'Data units converter' description: 'Data units converter'
version: '0.0.2' version: '0.0.1'
license: 'Unlicense' license: 'Unlicense'
dependencies: [] dependencies: []
} }