Show / Hide Table of Contents

    Class StringBuilderExtensions

    Inheritance
    System.Object
    StringBuilderExtensions
    Namespace: Lucene.Net.Support
    Assembly: Lucene.Net.dll
    Syntax
    public static class StringBuilderExtensions : object

    Methods

    | Improve this Doc View Source

    AppendCodePoint(StringBuilder, Int32)

    Appends the string representation of the codePoint argument to this sequence.

    The argument is appended to the contents of this sequence. The length of this sequence increases by CharCount(Int32).

    The overall effect is exactly as if the argument were converted to a array by the method ToChars(Int32) and the character in that array were then appended to this .

    Declaration
    public static StringBuilder AppendCodePoint(this StringBuilder text, int codePoint)
    Parameters
    Type Name Description
    StringBuilder text

    This .

    System.Int32 codePoint

    a Unicode code point

    Returns
    Type Description
    StringBuilder

    a reference to this object.

    | Improve this Doc View Source

    CodePointAt(StringBuilder, Int32)

    Returns the character (Unicode code point) at the specified index. The index refers to char values (Unicode code units) and ranges from 0 to Length - 1.

    If the char value specified at the given index is in the high-surrogate range, the following index is less than the length of this sequence, and the char value at the following index is in the low-surrogate range, then the supplementary code point corresponding to this surrogate pair is returned. Otherwise, the char value at the given index is returned.

    Declaration
    public static int CodePointAt(this StringBuilder text, int index)
    Parameters
    Type Name Description
    StringBuilder text

    this

    System.Int32 index

    the index to the char values

    Returns
    Type Description
    System.Int32

    the code point value of the character at the index

    | Improve this Doc View Source

    CodePointCount(StringBuilder, Int32, Int32)

    Returns the number of Unicode code points in the specified text range of this . The text range begins at the specified beginIndex and extends to the at index endIndex - 1. Thus the length (in s) of the text range is endIndex-beginIndex. Unpaired surrogates within this sequence count as one code point each.

    Declaration
    public static int CodePointCount(this StringBuilder text, int beginIndex, int endIndex)
    Parameters
    Type Name Description
    StringBuilder text

    this

    System.Int32 beginIndex

    the index to the first of the text range.

    System.Int32 endIndex

    the index after the last of the text range.

    Returns
    Type Description
    System.Int32

    the number of Unicode code points in the specified text range.

    | Improve this Doc View Source

    GetChars(StringBuilder)

    Copies the array from the into a new array and returns it.

    Declaration
    public static char[] GetChars(this StringBuilder text)
    Parameters
    Type Name Description
    StringBuilder text

    this

    Returns
    Type Description
    System.Char[]
    | Improve this Doc View Source

    IndexOf(StringBuilder, String)

    Searches for the first index of the specified character. The search for the character starts at the beginning and moves towards the end.

    Declaration
    public static int IndexOf(this StringBuilder text, string value)
    Parameters
    Type Name Description
    StringBuilder text

    This .

    System.String value

    The string to find.

    Returns
    Type Description
    System.Int32

    The index of the specified character, or -1 if the character isn't found.

    | Improve this Doc View Source

    IndexOf(StringBuilder, String, Int32)

    Searches for the index of the specified character. The search for the character starts at the specified offset and moves towards the end.

    Declaration
    public static int IndexOf(this StringBuilder text, string value, int startIndex)
    Parameters
    Type Name Description
    StringBuilder text

    This .

    System.String value

    The string to find.

    System.Int32 startIndex

    The starting offset.

    Returns
    Type Description
    System.Int32

    The index of the specified character, or -1 if the character isn't found.

    | Improve this Doc View Source

    Reverse(StringBuilder)

    Causes this character sequence to be replaced by the reverse of the sequence. If there are any surrogate pairs included in the sequence, these are treated as single characters for the reverse operation. Thus, the order of the high-low surrogates is never reversed.

    Let n be the character length of this character sequence (not the length in values) just prior to execution of the Reverse(StringBuilder) method. Then the character at index k in the new character sequence is equal to the character at index n-k-1 in the old character sequence.

    Note that the reverse operation may result in producing surrogate pairs that were unpaired low-surrogates and high-surrogates before the operation. For example, reversing "\uDC00\uD800" produces "\uD800\uDC00" which is a valid surrogate pair.

    Declaration
    public static StringBuilder Reverse(this StringBuilder text)
    Parameters
    Type Name Description
    StringBuilder text

    this

    Returns
    Type Description
    StringBuilder

    a reference to this .

    | Improve this Doc View Source

    ToCharSequence(StringBuilder)

    Convenience method to wrap a string in a StringBuilderCharSequenceWrapper so a can be used as ICharSequence in .NET.

    Declaration
    public static ICharSequence ToCharSequence(this StringBuilder text)
    Parameters
    Type Name Description
    StringBuilder text
    Returns
    Type Description
    ICharSequence
    • Improve this Doc
    • View Source
    Back to top Copyright © 2020 Licensed to the Apache Software Foundation (ASF)