MakeFixedLengthField

Databases
Aptilis 1

MakeFixedLengthField(Content, Length[, Padding Character])

MakeFixedLengthField creates a string from the string you gave it, and if necessary it will add spaces so that the new string will contain the specified number of characters.
If the original string contains more characters than requested, the new string will contain a truncated version of the original string.
You can optionally specify a different padding character.

Return value:
A string, possibly padded with strings, of the required length.

Example:

flf1 = makeFixedLengthField("Hello", 10) $
flf2 = makeFixedLengthField("Hello", 12, ".") $
flf3 = makeFixedLengthField("Good morning", 4, ".") $

print("len = ", int(len(flf1$)), " [", flf1$, "]\n")
print("len = ", int(len(flf2$)), " [", flf2$, "]\n")
print("len = ", int(len(flf3$)), " [", flf3$, "]\n")
Result:
len = 10 [Hello     ]
len = 12 [Hello.......]
len = 4 [Good]

Notes:
The fixed length field databases is not the native Aptilis database format. (see LoadDataBase). However, MakeFixedLengthField and getFixedLengthField allow you to load/save databases using that format.