Optimize RemoveChar a little

This commit is contained in:
Nikolaj Olsson 2021-02-07 10:27:52 +01:00
parent 4ddd60c3bd
commit 3ec673c5a6
2 changed files with 3 additions and 3 deletions

View File

@ -1,7 +1,6 @@
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
namespace Nikse.SubtitleEdit.Core.Common
@ -471,12 +470,13 @@ namespace Nikse.SubtitleEdit.Core.Common
public static string RemoveChar(this string value, params char[] charsToRemove)
{
var h = new HashSet<char>(charsToRemove);
char[] array = new char[value.Length];
int arrayIndex = 0;
for (int i = 0; i < value.Length; i++)
{
char ch = value[i];
if (!charsToRemove.Contains(ch))
if (!h.Contains(ch))
{
array[arrayIndex++] = ch;
}

View File

@ -15603,7 +15603,7 @@ namespace Nikse.SubtitleEdit.Forms
}
e.SuppressKeyPress = true;
}
else if (e.KeyCode == Keys.A && e.Modifiers == (Keys.Control | Keys.Alt | Keys.Shift))
else if (e.KeyCode == Keys.A && e.Modifiers == (Keys.Control | Keys.Alt | Keys.Shift))
{
if (GetCurrentSubtitleFormat().GetType() == typeof(AdvancedSubStationAlpha))
{