Files
spark/src/client/spark_core/utils/StringExtensions.cs
T

21 lines
549 B
C#

using System.Diagnostics.Contracts;
namespace bts.utils {
static class StringExtensions {
[Pure]
public static string EmptyIfNull(this string str) =>
str ?? "";
[Pure]
public static string NullIfEmpty(this string str) =>
str == "" ? null : str;
[Pure]
public static bool IsNullOrEmpty(this string str) =>
string.IsNullOrEmpty(str);
public static bool SafeContains(this string str, string value) =>
str != null && str.Contains(value);
}
}