• Home
  • API Documentation
Show / Hide Table of Contents
  • Mozzarella
    • ByteArrayExtensions
      • AsString
      • ToHexString
    • CoalesceOptions
      • None
      • WhiteSpaceAsEmpty
    • EnumerableOfStringExtensions
      • Coalesce
    • ErasableString
      • Clear
      • Dispose
      • ErasableString
      • IsCleared
      • IsDisposed
      • Value
    • StringBuilderExtensions
      • Append
      • AppendIf
      • AppendJoin
      • Contains
      • IndexOf
      • LastIndexOf
      • ToLower
      • ToUpper
      • Trim
      • TrimEnd
      • TrimStart
    • StringExtensions
      • AddPrefix
      • AddSuffix
      • AfterFirst
      • AfterLast
      • BeforeFirst
      • BeforeLast
      • CICompare
      • CIContains
      • CIEquals
      • CIReplace
      • Coalesce
      • Contains
      • ContainsOnly
      • IndexOfFirstDifference
      • IsAllDigits
      • IsAlphanumeric
      • IsNullOrEmpty
      • IsNullOrWhiteSpace
      • IsOnlyAlphas
      • IsOnlyDigits
      • LevenshteinDistanceTo
      • Like
      • NullIfEmpty
      • OCICompare
      • OCIContains
      • OCIEquals
      • OCIReplace
      • OEquals
      • PascalCaseToWords
      • RemoveAllExcept
      • RemoveAllWhiteSpace
      • RemoveNonAlphanumerics
      • RemoveNonAlphas
      • Replace
      • StripNonDigits
      • StripPrefix
      • StripSuffix
      • Truncate
  • Mozzarella.Tests
    • RemoveNonAlphanumerics
      • RemoveNonAlphanumerics_DoesNotRemoveNumerics
      • RemoveNonAlphanumerics_RemovesNonAlphanumerics
      • RemoveNonAlphanumerics_ReturnsEmptyForEmpty
      • RemoveNonAlphanumerics_ReturnsNullForNull
      • RemoveNonAlphanumerics_ReturnsOriginalStringWhenNoCharactersRemoved
    • RemoveNonAlphas
      • RemoveNonAlphas_RemovesNonNumericNonAlphas
      • RemoveNonAlphas_RemovesNumerics
      • RemoveNonAlphas_ReturnsEmptyForEmpty
      • RemoveNonAlphas_ReturnsNullForNull
      • RemoveNonAlphas_ReturnsOriginalStringWhenNoCharactersRemoved

Method Coalesce

Coalesce(String[])

Returns the first non-null, non-empty and non-whitespace string from those provided. If there is no non-null, non-empty string containing at least one non-whitespace character in values then null is returned.

Declaration
public static string Coalesce(this string[] values)
Parameters
Type Name Description
System.String[] values

A set of strings to coalesce.

Returns
Type Description
System.String

Returns a System.String if a non blank value is found, otherwise returns null.

Remarks

This overload treats strings containing only whitespace characters as being empty.

Coalesce(String[], CoalesceOptions)

Returns the first non-null, non-empty string from those provided. If there is no non-null, non-empty string in values then null is returned.

Declaration
public static string Coalesce(this string[] values, CoalesceOptions options)
Parameters
Type Name Description
System.String[] values

A set of strings to coalesce.

CoalesceOptions options

A value from the CoalesceOptions enum specifying options for deciding when to coalesce a value.

Returns
Type Description
System.String

Returns a System.String if a non blank value is found, otherwise returns null.

Coalesce(IEnumerable<String>)

Returns the first non-null, non-empty string from those provided. If there is no non-null, non-empty string containing at least one non-whitespace character in values then null is returned.

Declaration
public static string Coalesce(this IEnumerable<string> values)
Parameters
Type Name Description
System.Collections.Generic.IEnumerable<System.String> values

A set of strings to coalesce.

Returns
Type Description
System.String

Returns a System.String if a non blank value is found, otherwise returns null.

Remarks

This overload treats strings containing only whitespace characters as being empty.

Coalesce(IEnumerable<String>, CoalesceOptions)

Returns the first non-null, non-empty string from those provided. If there is no non-null, non-empty string in values then null is returned.

Declaration
public static string Coalesce(this IEnumerable<string> values, CoalesceOptions options)
Parameters
Type Name Description
System.Collections.Generic.IEnumerable<System.String> values

A set of strings to coalesce.

CoalesceOptions options

A value from the CoalesceOptions enum specifying options for deciding when to coalesce a value.

Returns
Type Description
System.String

Returns a System.String if a non blank value is found, otherwise returns null.

Back to top Copyright (c) 2017 Troy Willmot