Skip to content

Commit

Permalink
,=>. after stripping prefix
Browse files Browse the repository at this point in the history
  • Loading branch information
stevengj committed Mar 19, 2018
1 parent 50480e9 commit 5fc368c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/VersionParsing.jl
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ digits2num(s::AbstractString) = all(isdigit, s) ? parse(Int, s) : s
splitparts(s::AbstractString) = map(digits2num, filter!(!isempty, split(s, '.')))

function vparse(s_::String)
s = replace(s_, ','=>".") # treat , as . (e.g MS resource-file syntax)
s = replace(s, r"^[^\d]*[^.\d](\.?\d)"=>s"\1") # strip non-numeric prefix
s = replace(s_, r"^[^\d]*[^.\d](\.?\d)"=>s"\1") # strip non-numeric prefix
s = replace(s, ','=>".") # treat , as . (e.g MS resource-file syntax)
isempty(s) && throw(ArgumentError("non-numeric version string $s_"))
contains(s, r"^\.\d") && (s = "0" * s) # treat .x as 0.x
if contains(s, r"^\d:\d+") # debian-style version number
Expand Down

0 comments on commit 5fc368c

Please sign in to comment.