← Strings and Text

Strip the Terminator

easy

Removes the carriage return a barcode scanner adds to the end of each code.

What it teaches

Scanners and serial devices end a reply with a carriage return ($r), sometimes followed by a line feed ($l). Those characters count in LEN, so '123$r' has LEN 4 and does not match '123' typed in, though both look the same on screen. Removing a fixed number of characters breaks when a scanner changes from $r to $r$l: dropping one character from '123$r$l' leaves '123$r'. Keep what comes before the $r, wherever it is. A reply with no $r, such as 'ABC', is kept whole: FIND gives 0 when it finds nothing, and 0 is not a position in the text.

Parameters

TagDirectionTypeDefaultDescription
Ref_ReplyInOutSTRING—A scanner reply as received
Ref_CodeInOutSTRING—The code without its line ending

Required behavior