Text read from a stream often needs whitespace cleanup before parsing.

Trim Record

trim_record.lua
local line = 
local trimmed = string.match(line, "^%s*(.-)%s*$")

print("line=" .. line)
print("trimmed=" .. trimmed)
local line = 
local trimmed = string.match(line, "^%s*(.-)%s*$")

print("line=" .. line)
print("trimmed=" .. trimmed)
local line = 
local trimmed = string.match(line, "^%s*(.-)%s*$")

print("line=" .. line)
print("trimmed=" .. trimmed)
normalization Normalize text near the read boundary so later logic can compare stable values.