CapyKit/Docs/api/CapyKit.Extensions.StringExtensions.md

3.3 KiB

Class StringExtensions

Namespace: CapyKit.Extensions
Assembly: CapyKit.dll

Provides static extentions methods for providing additional functionality for types.

public static class StringExtensions

Inheritance

objectStringExtensions

Inherited Members

object.Equals(object?), object.Equals(object?, object?), object.GetHashCode(), object.GetType(), object.MemberwiseClone(), object.ReferenceEquals(object?, object?), object.ToString()

Extension Methods

ObjectExtensions.UpdateProperties(object, object)

Methods

IfNullOrEmpty(string, string)

Replaces a null or empty string with a specified replacement string.

public static string IfNullOrEmpty(this string value, string replacement)

Parameters

value string

The original string.

replacement string

The replacement string.

Returns

string

The original string if not null or empty, otherwise the replacement string.

See Also

string.IsNullOrEmpty[string](https://learn.microsoft.com/dotnet/api/system.string)?

IfNullOrWhiteSpace(string, string)

Replaces a null or whitespace string with a specified replacement string.

public static string IfNullOrWhiteSpace(this string value, string replacement)

Parameters

value string

The original string.

replacement string

The replacement string.

Returns

string

The original string if not null or whitespace, otherwise the replacement string.

See Also

string.IsNullOrWhiteSpace[string](https://learn.microsoft.com/dotnet/api/system.string)?