Home > Blockchain >  Zebra Scanner Adding Newline
Zebra Scanner Adding Newline

Time:09-28

I'm using a Zebra TC70 with DataWedge to capture scanned data. Every barcode I scan is having \r\n appended to the end.

Why is it doing this and how can I stop it?

CodePudding user response:

When you use any barcode reader, they usually come with a manual which include configurations. Like what characters should include after the reading.

For your particular scanner you can check this

The characters \r\n are escape characters indicating a new line.

Sometimes it's there, sometimes it's not, depending on the configuration of the reader.

If it bothers you, you can always replace the unwanted characters by empty characters

string myInput;
myInput=myInput.Replace("\r\n","");

myInput.Trim("\r\n".ToCharArray()) or TrimEnd are other alternatives

  • Related