GetFixedLengthField

Databases
Aptilis 1

GetFixedLengthField(String, Index, length_of_field)

GetFixedLengthField will isolate a field in a record of which each field has a known length. It works exactly like mid except that GetFixedLengthField will remove all the trailing spaces and tab characters at the end of the field.

Return value:
A substring from another string with terminating spaces and tabs trimmed off.

Example:

// first field: 12 chars, second field: 20 chars, third field 30 chars
// All padded with spaces

flrecord = "car         Volvo               Sweden                        " $

print("[", getFixedLengthField(flrecord$, 1, 12)$, "]\n")
print("[", getFixedLengthField(flrecord$, 13, 20)$, "]\n")
print("[", getFixedLengthField(flrecord$, 33, 30)$, "]\n")
Result:
[car]
[Volvo]
[Sweden]
See also:
getField, the equivalent native Aptilis format sub.

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.