mirror of
https://github.com/SubtitleEdit/subtitleedit.git
synced 2024-11-23 11:42:36 +01:00
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 <Ivandrofly@gmail.com>
This commit is contained in:
parent
d2915f8221
commit
b9580435e2
@ -291,7 +291,7 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats
|
||||
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 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats
|
||||
|
||||
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 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats
|
||||
}
|
||||
else if (step == 1 || step == 3 || step == 10 || step == 12) // number
|
||||
{
|
||||
if (char.IsDigit(ch))
|
||||
if (CharUtils.IsDigit(ch))
|
||||
{
|
||||
// ok
|
||||
}
|
||||
@ -454,7 +454,7 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats
|
||||
}
|
||||
else if (step == 5 || step == 13) // seconds
|
||||
{
|
||||
if (char.IsDigit(ch))
|
||||
if (CharUtils.IsDigit(ch))
|
||||
{
|
||||
// ok
|
||||
}
|
||||
@ -469,7 +469,7 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats
|
||||
}
|
||||
else if (step == 6 || step == 14) // milliseconds
|
||||
{
|
||||
if (char.IsDigit(ch))
|
||||
if (CharUtils.IsDigit(ch))
|
||||
{
|
||||
// ok
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user