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

◆ to_string() [2/2]

xtd::ustring xtd::version::to_string ( size_t  field_count) const

Converts the value of the current xtd::version object to its equivalent xtd::ustring representation. A specified count indicates the number of components to return.

Parameters
field_countThe number of components to return. The field_count ranges from 0 to 4.
Returns
The xtd::ustring representation of the values of the major, minor, build, and revision components of the current xtd::version object, each separated by a period character ('.'). The field_count parameter determines how many components are returned.
field_count Return Value
0 An empty string ("").
1 major
2 major.minor
3 major.minor.build
4 major.minor.build.revision
For example, if you create xtd::version object using the constructor xtd::version(1,3,5), xtd::version::to_string(2) returns "1.3" and xtd::version::to_string(4) throws an exception.
Exceptions
xtd::argument_exceptionfield_count is more than 4
-or-
field_count is more than the number of components defined in the current xtd::version object.