A parser checks syntax; validation checks whether the parsed value is allowed for a particular use. Keep those responsibilities visible. A required identifier may need trimming, a count may allow zero and a list may forbid duplicate keys. Silently repairing an invalid record can hide evidence that an upstream caller needs to fix. The functions in this lesson return explicit results for fictional requests. They do not reach a real service or database. Write each rule in terms of a boundary: empty after trimming, outside an inclusive range or seen before. The checks mix valid zero values with truly missing data so an overly broad rejection will fail. Preserve the original input when the task asks only for validation.
A meaningful name may have surrounding spaces.