M

UnitFormatUtils.TryParse

Description:
Parses a formatted string into a number with units if possible.
public static bool TryParse(
	Units units,
	ForgeTypeId specTypeId,
	string stringToParse,
	ValueParsingOptions valueParsingOptions,
	out double value
)
  • units
    The units formatting settings, typically obtained from Document.GetUnits().
  • specTypeId
    Identifier of the target spec for the value.
  • stringToParse
    The string to parse.
  • valueParsingOptions
    Additional parsing options.
  • value
    The parsed value. Ignore this value if the function returns false.
Return Value Boolean 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