From b9580435e2346679146b6f513fd8df9b02f9b3be Mon Sep 17 00:00:00 2001 From: Ivandro Jao Date: Mon, 28 Oct 2024 18:56:24 +0000 Subject: [PATCH] Refactor digit check logic to use CharUtils utility Replaced occurrences of `char.IsDigit` with `CharUtils.IsDigit` for consistency and potential future enhancements. This change improves the readability and maintainability of the code by centralizing character utility functions. Related to #1899 Signed-off-by: Ivandro Jao --- src/libse/SubtitleFormats/SubRip.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/libse/SubtitleFormats/SubRip.cs b/src/libse/SubtitleFormats/SubRip.cs index e1c33d2390..f593fa01a7 100644 --- a/src/libse/SubtitleFormats/SubRip.cs +++ b/src/libse/SubtitleFormats/SubRip.cs @@ -291,7 +291,7 @@ private static string RemoveBadChars(string line) private bool TryReadTimeCodesLine(string input, Paragraph paragraph, bool validate) { var s = input.TrimStart('-', ' '); - if (s.Length < 10 || !char.IsDigit(s[0])) + if (s.Length < 10 || !CharUtils.IsDigit(s[0])) { return false; } @@ -428,7 +428,7 @@ private static bool IsValidTimeCode(string line) if (step == 0 || step == 2 || step == 4 || step == 9 || step == 11) // start numbers { - if (ch == '-' || char.IsDigit(ch)) + if (ch == '-' || CharUtils.IsDigit(ch)) { step++; } @@ -439,7 +439,7 @@ private static bool IsValidTimeCode(string line) } else if (step == 1 || step == 3 || step == 10 || step == 12) // number { - if (char.IsDigit(ch)) + if (CharUtils.IsDigit(ch)) { // ok } @@ -454,7 +454,7 @@ private static bool IsValidTimeCode(string line) } else if (step == 5 || step == 13) // seconds { - if (char.IsDigit(ch)) + if (CharUtils.IsDigit(ch)) { // ok } @@ -469,7 +469,7 @@ private static bool IsValidTimeCode(string line) } else if (step == 6 || step == 14) // milliseconds { - if (char.IsDigit(ch)) + if (CharUtils.IsDigit(ch)) { // ok }