34 lines
985 B
C#
34 lines
985 B
C#
namespace adas_core.Domain.Utils;
|
|
|
|
public static class StringEx
|
|
{
|
|
public static bool IsEmpty(this string source)
|
|
{
|
|
return string.IsNullOrEmpty(source);
|
|
}
|
|
|
|
public static bool IsEmptyOrWhiteSpace(this string source)
|
|
{
|
|
return string.IsNullOrWhiteSpace(source);
|
|
}
|
|
|
|
public static string SubstringAfter(this string source, string value)
|
|
{
|
|
if (string.IsNullOrEmpty(source) || string.IsNullOrEmpty(value)) return source;
|
|
|
|
var index = source.IndexOf(value, StringComparison.Ordinal);
|
|
return index >= 0
|
|
? source.Substring(index + value.Length)
|
|
: source;
|
|
}
|
|
|
|
public static string SubstringBefore(this string source, string value)
|
|
{
|
|
if (string.IsNullOrEmpty(source) || string.IsNullOrEmpty(value)) return source;
|
|
|
|
var index = source.IndexOf(value, StringComparison.Ordinal);
|
|
return index >= 0
|
|
? source.Substring(0, index)
|
|
: source;
|
|
}
|
|
} |