From f3dddc98855c1ebdbda21feba1a672d42e719c19 Mon Sep 17 00:00:00 2001 From: Adam Stachowicz Date: Sat, 3 Feb 2024 19:59:55 +0100 Subject: [PATCH] Optimize `CheckNumericOnly` --- BarcodeStandard/BarcodeCommon.cs | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/BarcodeStandard/BarcodeCommon.cs b/BarcodeStandard/BarcodeCommon.cs index ac0a95f..235d4ed 100644 --- a/BarcodeStandard/BarcodeCommon.cs +++ b/BarcodeStandard/BarcodeCommon.cs @@ -1,6 +1,5 @@ using System; using System.Collections.Generic; -using System.Linq; namespace BarcodeStandard { @@ -17,15 +16,14 @@ protected void Error(string errorMessage) internal static bool CheckNumericOnly(string data) { - char c; - for (int i = 0; i < data.Length; i++) + foreach (var c in data) { - c = data[i]; if (c < '0' && c > '9') return false; } + return true; } - + internal static int GetAlignmentShiftAdjustment(Barcode barcode) { switch (barcode.Alignment)