From 668967527f635bd57b9b4eee53f945836dbebc19 Mon Sep 17 00:00:00 2001 From: Grand Silence Date: Wed, 30 Jan 2019 03:56:18 +0300 Subject: [PATCH] Added string.NotNullNotEmpty(). Method string.IsNullOrEmpty() renamed to NullOrEmpty. --- Leaf.Core/Extensions/String/StringExtensions.cs | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/Leaf.Core/Extensions/String/StringExtensions.cs b/Leaf.Core/Extensions/String/StringExtensions.cs index 39494e5..99e21a2 100644 --- a/Leaf.Core/Extensions/String/StringExtensions.cs +++ b/Leaf.Core/Extensions/String/StringExtensions.cs @@ -10,6 +10,9 @@ namespace Leaf.Core.Extensions.String /// public static class StringExtensions { + public const string HttpProto = "http://"; + public const string HttpsProto = "https://"; + /// /// Проверяет строку, является ли она ссылкой с протоколом http:// или https://. /// @@ -22,7 +25,7 @@ public static bool IsWebLink(this string self, bool trim = false) if (trim) link = link.Trim(); - return link.StartsWith("http://") || link.StartsWith("https://"); + return link.StartsWith(HttpProto) || link.StartsWith(HttpsProto); } /// @@ -37,7 +40,13 @@ public static bool IsWebLink(this string self, bool trim = false) /// Расширение для метода . /// /// Строка - public static bool IsNullOrEmpty(this string self) => string.IsNullOrEmpty(self); + public static bool NullOrEmpty(this string self) => string.IsNullOrEmpty(self); + + /// + /// Инвертированный вызов . + /// + /// Вернет если строка не является пустой или . + public static bool NotNullNotEmpty(this string self) => !string.IsNullOrEmpty(self); /// /// Проверка строки на полезный контент.