Formats a detail string with optional range, percentage, prefix, and suffix.
This function allows customization in formatting a detail string based on the specified options,
including support for range, percentage, or additional prefix/suffix customization.
If formatAsRangeOrAmount is set to RangeOrAmountEnum.Range, it formats as a range using
minPercent and maxPercent.
If formatAsRangeOrAmount is set to RangeOrAmountEnum.Amount, it formats as a single percentage value.
If formatAsRangeOrAmount is set to RangeOrAmountEnum.None, only details is returned.
Optional parentheses are added around the range or percentage if percentagePrefix or percentageSuffix is specified.
Formats a detail string with optional range, percentage, prefix, and suffix. This function allows customization in formatting a detail string based on the specified options, including support for range, percentage, or additional prefix/suffix customization.
formatAsRangeOrAmountis set toRangeOrAmountEnum.Range, it formats as a range usingminPercentandmaxPercent.formatAsRangeOrAmountis set toRangeOrAmountEnum.Amount, it formats as a single percentage value.formatAsRangeOrAmountis set toRangeOrAmountEnum.None, onlydetailsis returned.percentagePrefixorpercentageSuffixis specified.Formatting Examples:
Range with Prefix and Suffix
{ details: "Usage", formatAsRangeOrAmount: RangeOrAmountEnum.Range, percentagePrefix: PercentagePrefixEnum.UpTo, minPercent: 10, maxPercent: 20, percentageSuffix: "% or higher" }(up to 10 - 20% or higher) UsageSingle Percentage Amount
{ details: "Rate", formatAsRangeOrAmount: RangeOrAmountEnum.Amount, percent: 50 }(50%) RateNo Range or Amount Formatting (Details Only)
{ details: "Performance", formatAsRangeOrAmount: RangeOrAmountEnum.None }PerformanceRange without Prefix or Suffix
{ details: "Range Detail", formatAsRangeOrAmount: RangeOrAmountEnum.Range, minPercent: 15, maxPercent: 25 }(15 - 25%) Range DetailAmount with Prefix Only
{ details: "Limit", formatAsRangeOrAmount: RangeOrAmountEnum.Amount, percent: 75, percentagePrefix: PercentagePrefixEnum.About }(about 75%) Limit