Fixed Width Column Inputs - format and text alignment #24
-
In the Fixed Width Column Input Module, there's a format paramter. How does this work for strings? How do you achieve left and right alignment? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Typically, the format for a string will take the form of The format input parameter utilizes the
If the value of alignment is less than the length of the argument to be inserted, alignment is ignored and the length of the string representation of the argument is used as the field width.
Full documentation is available here: https://docs.microsoft.com/en-us/dotnet/api/system.string.format?view=netframework-4.8 |
Beta Was this translation helpful? Give feedback.
Typically, the format for a string will take the form of
{i,x}
where i is the index and x specifies the alignment and formatting. For example,{0,12}
means a right-aligned 12-character string, whereas{0,-12}
means a left-aligned 12-character string.The format input parameter utilizes the
string.Format
method. From the docs:index
The zero-based index of the argument whose string representation is to be included at this position in the string. If this argument is null, an empty string will be included at this position in the string.alignment
Optional. A signed integer that indicates the total length of the field into which the argument is inserted and whether it is right-aligned (a posi…