mirror of
https://github.com/SubtitleEdit/subtitleedit.git
synced 2024-11-25 20:52:44 +01:00
Improve efficiency of NoBreakAfterItem.IsMatch()
Refact commit dce7c5a6d6
.
This commit is contained in:
parent
d4f1e4f28f
commit
5fbf4a9ad4
@ -32,7 +32,13 @@ namespace Nikse.SubtitleEdit.Core
|
||||
return Regex.IsMatch(line);
|
||||
}
|
||||
|
||||
return line.EndsWith($" {Text}", StringComparison.Ordinal) || line.Equals(Text, StringComparison.Ordinal);
|
||||
if (line.EndsWith(Text, StringComparison.Ordinal))
|
||||
{
|
||||
var indexBeforeText = line.Length - Text.Length - 1;
|
||||
return indexBeforeText < 0 || line[indexBeforeText] == ' ';
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
|
Loading…
Reference in New Issue
Block a user