Version: Unity 6.7 Alpha (6000.7)
LanguageEnglish
  • C#

IFormattingInfo

interface in Unity.SmartStrings.Core.Extensions

Suggest a change

Success!

Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.

Close

Submission failed

For some reason your suggested change could not be submitted. Please <a>try again</a> in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.

Close

Cancel

Description

Contains all necessary info for formatting a value

In "{Items.Length:choose(1,2,3):one|two|three}", the IFormattingInfo.CurrentValue would be the value of "Items.Length", the IFormattingInfo.FormatterOptions would be "1,2,3", and the IFormattingInfo.Format would be "one|two|three".

Properties

Property Description
Alignment Alignment inserts spaces into the output to ensure consistent length. Positive numbers insert spaces to the left, to right-align the text. Negative numbers insert spaces to the right, to left-align the text. This should only work with the Default Formatter, but is optional with custom formatters. This is primarily for compatibility with String.Format.
CurrentValue The current value that is to be formatted.
Format This format specifies how to output the IFormattingInfo.CurrentValue.
FormatDetails Infrequently used details, often used for debugging
FormatterOptions When a named formatter is used, this will hold the options. For example, in "{0:choose(1,2,3):one|two|three}", FormatterOptions is "1,2,3".
Placeholder Contains all the details about the current placeholder.

Public Methods

Method Description
FormatAsChild Creates a child IFormattingInfo from the current IFormattingInfo instance and invokes formatting with SmartFormatter with the child as parameter.
FormattingException Creates a IFormattingInfo.FormattingException associated with the IFormattingInfo.Format.
Write Writes a string to the output.