Creado apartir del commit b888de6c92056de294456f581a56e25e734d4ab7 de develop
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user