Simplified Format() Command
Posted: 18 Oct 2017, 13:42
I suggest that the Format() command be simplified, particularly if you are only formatting a single string. As it stands now, I find it very confusing to use. I have to look up the documentation every time that I want to use it, and even then, it takes a while to figure out exactly what I need to do to get the desired result.
For me, the main problem with this command is that it is designed for the use case of formatting multiple values at once. Is that really the most common use case for a format command? In my experience, I only ever use this command to format a single string. For example, I often convert a decimal value to a hex value, trim off extra significant digits from the decimal side of a float, or pad a number with spaces.
To format a single string, I must include this extra syntactic sugar: Format("{1:0.2f}", myString). These extra characters are meaningless when formatting a single string - it is not intuitive why I would need them.
Would it be possible to make this command support a simplified format string without curly braces? Maybe just detect if the format string does not begin with {, then treat it as a request to only format a single string. I also think the documentation should be updated to treat this as the default use case (and explain the more complicated {Index:Format} behavior in the Remarks section, to keep it from confusing typical users.
For me, the main problem with this command is that it is designed for the use case of formatting multiple values at once. Is that really the most common use case for a format command? In my experience, I only ever use this command to format a single string. For example, I often convert a decimal value to a hex value, trim off extra significant digits from the decimal side of a float, or pad a number with spaces.
To format a single string, I must include this extra syntactic sugar: Format("{1:0.2f}", myString). These extra characters are meaningless when formatting a single string - it is not intuitive why I would need them.
Would it be possible to make this command support a simplified format string without curly braces? Maybe just detect if the format string does not begin with {, then treat it as a request to only format a single string. I also think the documentation should be updated to treat this as the default use case (and explain the more complicated {Index:Format} behavior in the Remarks section, to keep it from confusing typical users.