Skip to content

Commit aed199d

Browse files
authored
Merge pull request #190 from Saibamen/optimize_CheckNumericOnly
Optimize `CheckNumericOnly`
2 parents e534f8e + f3dddc9 commit aed199d

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

BarcodeStandard/BarcodeCommon.cs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
using System;
22
using System.Collections.Generic;
3-
using System.Linq;
43

54
namespace BarcodeStandard
65
{
@@ -17,15 +16,14 @@ protected void Error(string errorMessage)
1716

1817
internal static bool CheckNumericOnly(string data)
1918
{
20-
char c;
21-
for (int i = 0; i < data.Length; i++)
19+
foreach (var c in data)
2220
{
23-
c = data[i];
2421
if (c < '0' && c > '9') return false;
2522
}
23+
2624
return true;
2725
}
28-
26+
2927
internal static int GetAlignmentShiftAdjustment(Barcode barcode)
3028
{
3129
switch (barcode.Alignment)

0 commit comments

Comments
 (0)