Fixed Width Column Inputs - format and text alignment

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?

Comments

  • 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 positive integer) or left-aligned (a negative integer). If you omit alignment, the string representation of the corresponding argument is inserted in a field with no leading or trailing spaces.

    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.

    formatString

    Optional. A string that specifies the format of the corresponding argument's result string.

    Full documentation is available here: https://docs.microsoft.com/en-us/dotnet/api/system.string.format?view=netframework-4.8

Sign In or Register to comment.