public static string? ValidateString()

in src/Epam.Kafka.PubSub/Common/Options/PubSubOptionsValidate.cs [64:78]


    public static string? ValidateString(string name, string? value,
        bool canBeNullOrWhitespace = false, Regex? regex = null)
    {
        if (!canBeNullOrWhitespace && string.IsNullOrWhiteSpace(value))
        {
            return $"{name} is null or empty.";
        }

        if (value != null && regex != null && !regex.IsMatch(value))
        {
            return $"{name} is not match '{regex}'.";
        }

        return null;
    }