Table of Contents

Class StringEx

Namespace
adas_core.Domain.Utils
Assembly
adas-core.Domain.dll

Provides static extension methods for the string type.

public static class StringEx
Inheritance
StringEx
Inherited Members

Methods

IsEmpty(string)

Determines whether the specified string is null or an empty string.

public static bool IsEmpty(this string source)

Parameters

source string

The string to evaluate.

Returns

bool

true if source is null or an empty string; otherwise, false.

IsEmptyOrWhiteSpace(string)

Determines whether the specified string is null, empty, or consists only of white-space characters.

public static bool IsEmptyOrWhiteSpace(this string source)

Parameters

source string

The string to evaluate.

Returns

bool

true if the string is null, empty, or contains only white space; otherwise, false.

SubstringAfter(string, string)

Returns the portion of the source string that follows the first occurrence of the specified value, using ordinal (case-sensitive, culture-insensitive) comparison. If the source or value is null or empty, or the value is not found within the source, the original source is returned unchanged.

public static string SubstringAfter(this string source, string value)

Parameters

source string

The string to search within.

value string

The delimiter whose first occurrence marks the start of the returned substring.

Returns

string

The substring after the first occurrence of value; otherwise, the original source.

SubstringBefore(string, string)

Returns the portion of source that precedes the first occurrence of value, using ordinal comparison. If either source or value is null or empty, or if value is not found within source, the original source is returned unchanged.

public static string SubstringBefore(this string source, string value)

Parameters

source string

The string to extract the substring from.

value string

The delimiter whose first occurrence marks the end of the returned substring.

Returns

string

The substring of source before the first occurrence of value, or the original source when no match is found or when either input is null or empty.