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,ForgeTypeId,String,ValueParsingOptions,Double)
public static bool TryParse(
Units units,
ForgeTypeId specTypeId,
string stringToParse,
ValueParsingOptions valueParsingOptions,
out double value
)
-
unitsThe units formatting settings, typically obtained from Document.GetUnits().
-
specTypeIdIdentifier of the target spec for the value.
-
StringstringToParseThe string to parse.
-
valueParsingOptionsAdditional parsing options.
-
Double%valueThe parsed value. Ignore this value if the function returns false.
Return Value
bool
True if the string can be parsed, false otherwise.
-
specTypeId is not a measurable spec identifier. See UnitUtils.IsMeasurableSpec(ForgeTypeId). -or- The unit in the FormatOptions in valueParsingOptions is not a valid unit for specTypeId. See UnitUtils.IsValidUnit(ForgeTypeId, ForgeTypeId) and UnitUtils.GetValidUnits(ForgeTypeId).
-
A non-optional argument was null