UnitFormatUtils.TryParse
Description:
Parses a formatted string into a number with units if possible.
Parses a formatted string into a number with units if possible.
Overloads (4):
TryParse(Units,UnitType,String,ValueParsingOptions,Double,String)
-
unitsThe units formatting settings, typically obtained from Document.GetUnits().
-
unitTypeThe target unit type for the value.
-
stringToParseThe string to parse.
-
valueParsingOptionsAdditional parsing options.
-
valueThe parsed value, in Revit's internal units. Ignore this value if the function returns false.
-
messageA localized message that, if the parsing fails, explains the reason for failure.
Return Value
bool
True if the string can be parsed, false otherwise.
-
unitType is an invalid unit type. See UnitUtils.IsValidUnitType() and UnitUtils.GetValidUnitTypes(). -or- The display unit in the FormatOptions in valueParsingOptions is not a valid display unit for unitType. See UnitUtils.IsValidDisplayUnit(UnitType, DisplayUnitType) and UnitUtils.GetValidDisplayUnits(UnitType).
-
A non-optional argument was NULL
-
A value passed for an enumeration argument is not a member of that enumeration