Version: Unity 6.7 Alpha (6000.7)
Language : English
Populate strings with data using Sources
Dictionary source

Default source

Select an argument by its numeric index, the same way String.Format does.

The Default source extracts an argument by index, similarly to String.Format. It examines the current selector, and if the selector parses as an integer that is a valid index into the arguments passed to Smart.Format, it returns the argument at that index. No further selectors are considered for that placeholder.

The selector only resolves as an index when it is the first selector in the placeholder and has no operator, matching the way String.Format treats {0}. The selector must parse as an integer and be within the number of arguments provided, otherwise the source does not handle it and the next source is tried.

In the following example, the Default source resolves 0 in the selector {0.Name} to the first argument. Then, another source (such as the Properties source) resolves Name against that value.

When no index is given, for example {Name}, the argument at index 0 is used by the other sources.

Smart String Arguments Result
{0} {1} {2} 1, 2, 3 1 2 3
{1} {1} {2} {0} 1, 2, 3 2 2 3 1
Player {0} scored {1} points "Potato", 155 Player Potato scored 155 points
Player {0.Name} scored {0.Points} points new { Name = "One", Points = 100 } Player One scored 100 points
Smart.Format("{0} {1} {2}", 1, 2, 3);                          // "1 2 3"
Smart.Format("Player {0} scored {1} points", "Potato", 155);   // "Player Potato scored 155 points"

Additional resources

Populate strings with data using Sources
Dictionary source