• 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 BeforeLast

BeforeLast(String, String)

Returns the portion of value that occurs before the last instance of searchValue.

Declaration
public static string BeforeLast(this string value, string searchValue)
Parameters
Type Name Description
System.String value

The value to search in.

System.String searchValue

The value to search for.

Returns
Type Description
System.String

Either null, or a new string containing the portion of the string before the last occurrence of searchValue.

Remarks

Returns null if searchValue is null, empty string or if searchValue does not occur within value.

Matching of searchValue is done using a System.StringComparison.Ordinal comparison.

BeforeLast(String, String, StringComparison)

Returns the portion of value that occurs before the last instance of searchValue.

Declaration
public static string BeforeLast(this string value, string searchValue, StringComparison comparisonMethod)
Parameters
Type Name Description
System.String value

The value to search in.

System.String searchValue

The value to search for.

System.StringComparison comparisonMethod

A value from the System.StringComparison enum specfying how searchValue is matched (or not).

Returns
Type Description
System.String

Either null, or a new string containing the portion of the string before the last occurrence of searchValue.

Remarks

Returns null if searchValue is null, empty string or if searchValue does not occur within value.

Matching of searchValue is done using a System.StringComparison.Ordinal comparison.

Back to top Copyright (c) 2017 Troy Willmot