xtd 0.2.0
Loading...
Searching...
No Matches

◆ parse()

static version xtd::version::parse ( const xtd::string input)
static

Converts the string representation of a version number to an equivalent Version object.

Parameters
inputA string that contains a version number to convert.
Returns
An object that is equivalent to the version number specified in the input parameter.
Exceptions
xtd::argument_out_of_range_exceptionA major, minor, build, or revision component is less than zero.
xtd::format_exceptionAt least one component of input does not parse to an integer.
xtd::overflow_exceptionAt least one component of input represents a number greater than std::numeric_limits<int32>::max().
Remarks
The input parameter must have the following format:
major.minor[.build[.revision]] 
where major, minor, build, and revision are the string representations of the version number's four components: major version number, minor version number, build number, and revision number, respectively. Optional components are shown in square brackets ([ and ]). The components must appear in the specified order and must be separated by periods
Warning
Because the string representation of a version number must conform to a recognized pattern, applications should always use exception handling when calling the xtd::version::parse method to parse user input. Alternatively, you can call the xtd::version::try_parse method to parse the string representation of a version number and return a value that indicates whether the parse operation succeeded.
Remarks
The xtd::version::parse method is a convenience method; it is equivalent to calling the xtd::version(const string&) constructor.