<Code Lib>
M

UnitFormatUtils.TryParse(Units, ForgeTypeId, String, ValueParsingOptions, Double)

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.
  • String
    stringToParse
    The string to parse.
  • valueParsingOptions
    Additional parsing options.
  • Double%
    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

Loading…