dmdLikeVersionToSemverLike

Turn a DMD-like version (e.g. 2.082.1) into a SemVer-like version (e.g. 2.82.1). The function accepts a dependency operator prefix and some text postfix. Prefix and postfix are returned verbatim.

package package(dub)
string
dmdLikeVersionToSemverLike
(
string ver
)

Parameters

ver string

version string, possibly with a dependency operator prefix and some test postfix.

Return Value

Type: string

A Semver compliant string

Examples

assert(dmdLikeVersionToSemverLike("2.082.1") == "2.82.1");
assert(dmdLikeVersionToSemverLike("2.082.0") == "2.82.0");
assert(dmdLikeVersionToSemverLike("2.082") == "2.82.0");
assert(dmdLikeVersionToSemverLike("~>2.082") == "~>2.82.0");
assert(dmdLikeVersionToSemverLike("~>2.082-beta1") == "~>2.82.0-beta1");
assert(dmdLikeVersionToSemverLike("2.4.6") == "2.4.6");
assert(dmdLikeVersionToSemverLike("2.4.6-alpha12") == "2.4.6-alpha12");

Meta