IcuVersion::normalize()

static string|null normalize(string $version, int|null $precision)

Normalizes a version string to the number of components given in the parameter $precision.

A single digit release version and a single digit major version are contracted to a two digit release version. If no major version is given, it is substituted by zero.

Examples:

IcuVersion::normalize('1.2.3.4');
// => '12.3.4'

IcuVersion::normalize('1.2.3.4', 1);
// => '12'

IcuVersion::normalize('1.2.3.4', 2);
// => '12.3'

Parameters

string $version An ICU version string
int|null $precision The number of components to include. Pass NULL to return the version unchanged.

Return Value

string|null The normalized ICU version or NULL if it couldn't be normalized.
doc_Symfony
2016-10-28 06:20:53
Comments
Leave a Comment

Please login to continue.