Remove TextLengthHelper class from project

The TextLengthHelper.cs file under the TextLengthCalculator in the common library has been completely deleted. This change removes redundant functions and helps to streamline the codebase.
This commit is contained in:
Ivandro Jao 2024-02-02 22:22:46 +00:00
parent 51f95d9489
commit 3708e0c3da

View File

@ -1,30 +0,0 @@
using System;
namespace Nikse.SubtitleEdit.Core.Common.TextLengthCalculator
{
public static class TextLengthHelper
{
public static decimal CountCharacters(string text, bool forCps)
{
return CalcFactory.MakeCalculator(Configuration.Settings.General.CpsLineLengthStrategy).CountCharacters(text, forCps);
}
public static bool IsKnownHtmlTag(string input, int index)
{
var s = input.Remove(0, index + 1).ToLowerInvariant();
return s.StartsWith('/') ||
s.StartsWith("i>", StringComparison.Ordinal) ||
s.StartsWith("b>", StringComparison.Ordinal) ||
s.StartsWith("u>", StringComparison.Ordinal) ||
s.StartsWith("font ", StringComparison.Ordinal) ||
s.StartsWith("ruby", StringComparison.Ordinal) ||
s.StartsWith("span>", StringComparison.Ordinal) ||
s.StartsWith("span ", StringComparison.Ordinal) ||
s.StartsWith("p>", StringComparison.Ordinal) ||
s.StartsWith("br>", StringComparison.Ordinal) ||
s.StartsWith("box>", StringComparison.Ordinal) ||
s.StartsWith("div>", StringComparison.Ordinal) ||
s.StartsWith("div ", StringComparison.Ordinal);
}
}
}