Class StringExtensions
- Namespace
- OneImlx.Shared.Extensions
- Assembly
- OneImlx.Shared.dll
string extension methods.
public static class StringExtensions
- Inheritance
-
StringExtensions
- Inherited Members
Methods
EmptyIfNull(string?)
Returns an empty string if this string is null.
public static string EmptyIfNull(this string? self)
Parameters
self
stringThe string to check.
Returns
- string
true
if string is not null or white space, otherwisefalse
.
IsNotNullOrWhiteSpace(string?)
Determines if the string is not null or white space.
public static bool IsNotNullOrWhiteSpace(this string? self)
Parameters
self
stringThe string to check.
Returns
- bool
true
if string is not null or white space, otherwisefalse
.
IsNullOrEmpty(string?)
Determines if the string is null or empty.
public static bool IsNullOrEmpty(this string? self)
Parameters
self
stringThe string to check.
Returns
- bool
true
if string is null or empty, otherwisefalse
.
IsNullOrWhiteSpace(string?)
Determines if the string is null or white space.
public static bool IsNullOrWhiteSpace(this string? self)
Parameters
self
stringThe string to check.
Returns
- bool
true
if string is null or empty, otherwisefalse
.
JoinByComma(IEnumerable<string>?)
Joins the string collection with a ,
separator.
public static string JoinByComma(this IEnumerable<string>? list)
Parameters
list
IEnumerable<string>A collection of string to join.
Returns
- string
A joined string.
JoinByNewline(IEnumerable<string>?)
Joins the string collection with a NewLine separator.
public static string JoinByNewline(this IEnumerable<string>? list)
Parameters
list
IEnumerable<string>A collection of string to join.
Returns
- string
A joined string.
JoinBySpace(IEnumerable<string>?)
Joins the string collection with a space separator.
public static string JoinBySpace(this IEnumerable<string>? list)
Parameters
list
IEnumerable<string>A collection of string to join.
Returns
- string
A joined string.
NotNull(string?)
Returns a non null string.
public static string NotNull(this string? self)
Parameters
self
stringThe string to check.
Returns
- string
true
if string is not null or white space, otherwisefalse
.
Repeat(string, int)
Repeats the string for the specified times.
public static string Repeat(this string value, int count)
Parameters
Returns
- string
New repeated string.
SplitByComma(string?)
Splits the string with a ,
separator.
public static string[] SplitByComma(this string? self)
Parameters
self
stringThe string to split.
Returns
- string[]
An array of string split by , separator.
SplitByNewline(string?)
Splits the string with a NewLine.
public static string[] SplitByNewline(this string? self)
Parameters
self
stringThe string to split.
Returns
- string[]
An array of string split by newline separator.
SplitBySpace(string?)
Splits the string with a space separator.
public static string[] SplitBySpace(this string? self)
Parameters
self
stringThe string to split.
Returns
- string[]
An array of string split by space separator.
TrimEnd(string, string?, StringComparison)
Removes the trailing occurrence of a string recursively.
public static string TrimEnd(this string self, string? trim, StringComparison stringComparison)
Parameters
self
stringThe string to trim.
trim
stringThe string to trim from start.
stringComparison
StringComparisonThe string comparison.
Returns
TrimStart(string, string?, StringComparison)
Removes the leading occurrence of a string recursively.
public static string TrimStart(this string self, string? trim, StringComparison stringComparison)
Parameters
self
stringThe string to trim.
trim
stringThe string to trim from start.
stringComparison
StringComparisonThe string comparison.