using System.Text.RegularExpressions; using Humanizer; namespace Elsa.Telnyx.Extensions; internal static class StringExtensions { private static readonly Regex WhiteList = new(@"[^a-zA-Z0-9-_.!~+ ]"); /// /// Sanitizes the caller name. /// public static string? SanitizeCallerName(this string? value) => value == null ? null : WhiteList.Replace(value, "").Truncate(128); /// /// Returns null if the specifies string is empty. /// public static string? EmptyToNull(this string? value) => value is "" ? null : value; }