perf: cache regex in StripWhitespace

Use existing Whitespace Lazy<Regex> instead of creating new Regex each call.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-12-07 22:17:04 +00:00
parent 3d463ad0c5
commit 580da1b8e6

View File

@@ -345,7 +345,7 @@ public static partial class StringExtensions
/// </summary>
/// <param name="txt"></param>
/// <returns></returns>
public static string StripWhitespace(this string txt) => Regex.Replace(txt, @"\s", string.Empty);
public static string StripWhitespace(this string txt) => Whitespace.Value.Replace(txt, string.Empty);
/// <summary>
/// Strips carrage returns and line feeds from the specified text.