mirror of
https://github.com/SubtitleEdit/subtitleedit.git
synced 2024-11-23 11:42:36 +01:00
Expose NeutralSentenceEndingChars and optimize method in FixCommas
Make NeutralSentenceEndingChars publicly accessible by changing its access modifier to public. Also, refactor the IsNextCharSentenceClosingSymbol method in FixCommas to utilize the NeutralSentenceEndingChars for more concise and efficient logic. Signed-off-by: Ivandro Jao <Ivandrofly@gmail.com>
This commit is contained in:
parent
dedbe0b878
commit
b91a281e85
@ -771,7 +771,7 @@ namespace Nikse.SubtitleEdit.Core.Common
|
||||
return value.HasSentenceEnding(string.Empty);
|
||||
}
|
||||
|
||||
private static readonly HashSet<char> NeutralSentenceEndingChars = new HashSet<char>
|
||||
public static readonly IReadOnlyCollection<char> NeutralSentenceEndingChars = new HashSet<char>
|
||||
{
|
||||
'.', '!', '?', ']', ')', '…', '♪', '؟', '。', '?'
|
||||
};
|
||||
|
@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Nikse.SubtitleEdit.Core.Interfaces;
|
||||
using System.Text.RegularExpressions;
|
||||
using Nikse.SubtitleEdit.Core.Common;
|
||||
@ -98,13 +99,7 @@ namespace Nikse.SubtitleEdit.Core.Forms.FixCommonErrors
|
||||
|
||||
bool IsNextCharSentenceClosingSymbol(int index, char[] characters)
|
||||
{
|
||||
if (index + 1 < characters.Length)
|
||||
{
|
||||
var nextChar = characters[index + 1];
|
||||
return nextChar == '.' || nextChar == '?' || nextChar == '!' || nextChar == ')' || nextChar == ']' || nextChar == '؟';
|
||||
}
|
||||
|
||||
return false;
|
||||
return index + 1 < characters.Length && StringExtensions.NeutralSentenceEndingChars.Contains(characters[index + 1]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user