Default source
Select an argument by its numeric index, the same way String.Format does.
Read time 1 minuteLast updated 6 days ago
Select an argument by its numeric index, the same way does.
String.FormatThe 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 , it returns the argument at that index. No further selectors are considered for that placeholder.
Smart.FormatThe selector only resolves as an index when it is the first selector in the placeholder and has no operator, matching the way treats . 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.
String.Format{0}In the following example, the Default source resolves in the selector to the first argument. Then, another source (such as the Properties source) resolves against that value.
0{0.Name}NameWhen no index is given, for example , the argument at index is used by the other sources.
{Name}0Smart String | Arguments | Result |
|---|---|---|
| | 1 2 3 |
| | 2 2 3 1 |
| | Player Potato scored 155 points |
| | 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"