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

IndexOf(StringBuilder, String)

Returns the ordinal position of the start of searchValue within searchValue.

Declaration
public static int IndexOf(this StringBuilder builder, string searchValue)
Parameters
Type Name Description
System.Text.StringBuilder builder

The string builder to search the contents of.

System.String searchValue

The string to search for.

Returns
Type Description
System.Int32

Returns -1 if searchValue does not exist within builder, otherwise returns the ordinal position at which searchValue starts.

Exceptions
Type Condition
System.ArgumentNullException

Thrown if builder or searchValue is null.

System.ArgumentException

Thrown if searchValue is an empty string.

IndexOf(StringBuilder, String, Int32)

Returns the ordinal position of the start of searchValue within searchValue.

Declaration
public static int IndexOf(this StringBuilder builder, string searchValue, int startIndex)
Parameters
Type Name Description
System.Text.StringBuilder builder

The string builder to search the contents of.

System.String searchValue

The string to search for.

System.Int32 startIndex

The first character position at which to start the search.

Returns
Type Description
System.Int32

Returns -1 if searchValue does not exist within builder, otherwise returns the ordinal position at which searchValue starts.

Remarks

This method uses ordinal comparisions when searching for searchValue.

Exceptions
Type Condition
System.ArgumentOutOfRangeException

Thrown if startIndex is less than 0 or greater than the length of the string builder.

System.ArgumentNullException

Thrown if builder or searchValue is null.

System.ArgumentException

Thrown if searchValue is an empty string.

Back to top Copyright (c) 2017 Troy Willmot