to_length

Defined in header: <orcus/measurement.hpp>

length_t orcus::to_length(std::string_view str)

Parse a string value containing a part representing a numerical value optionally followed by a part representing a unit of measurement.

Examples of such string value are: “1.234in”, “0.34cm” and so on.

Parameters:

str – original string value.

Returns:

structure containing a numerical value and a unit of measurement that the original string value represents.