Show / Hide Table of Contents

    Class StringExtensions

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

    Methods

    | Improve this Doc View Source

    CodePointAt(String, Int32)

    Declaration
    public static int CodePointAt(this string str, int index)
    Parameters
    Type Name Description
    System.String str
    System.Int32 index
    Returns
    Type Description
    System.Int32
    | Improve this Doc View Source

    CodePointCount(String, 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 the text range count as one code point each.

    Declaration
    public static int CodePointCount(this string str, int beginIndex, int endIndex)
    Parameters
    Type Name Description
    System.String str
    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

    CompareToOrdinal(String, String)

    This method mimics the Java String.compareTo(String) method in that it

    1. Compares the strings using lexographic sorting rules
    2. Performs a culture-insensitive comparison
    This method is a convenience to replace the .NET CompareTo method on all strings, provided the logic does not expect specific values but is simply comparing them with > or <.

    Declaration
    public static int CompareToOrdinal(this string str, string value)
    Parameters
    Type Name Description
    System.String str
    System.String value

    The string to compare with.

    Returns
    Type Description
    System.Int32

    An integer that indicates the lexical relationship between the two comparands. Less than zero indicates the comparison value is greater than the current string. Zero indicates the strings are equal. Greater than zero indicates the comparison value is less than the current string.

    | Improve this Doc View Source

    GetBytes(String, Encoding)

    Declaration
    public static byte[] GetBytes(this string str, Encoding enc)
    Parameters
    Type Name Description
    System.String str
    Encoding enc
    Returns
    Type Description
    System.Byte[]
    | Improve this Doc View Source

    IndexOf(String, Int32)

    Returns the index within this string of the first occurrence of the specified codePoint.

    Declaration
    public static int IndexOf(this string str, int codePoint)
    Parameters
    Type Name Description
    System.String str

    this string

    System.Int32 codePoint

    a codePoint representing a single character or surrogate pair

    Returns
    Type Description
    System.Int32

    the index of the first occurrence of the character (or surrogate pair) in the string, or -1 if the character (or surrogate pair) doesn't occur.

    | Improve this Doc View Source

    Intern(String)

    Searches an internal table of strings for a string equal to this string. If the string is not in the table, it is added. Returns the string contained in the table which is equal to this string. The same string object is always returned for strings which are equal.

    Declaration
    public static string Intern(this string s)
    Parameters
    Type Name Description
    System.String s
    Returns
    Type Description
    System.String

    The interned string equal to this string.

    | Improve this Doc View Source

    OffsetByCodePoints(String, Int32, Int32)

    Declaration
    public static int OffsetByCodePoints(this string seq, int index, int codePointOffset)
    Parameters
    Type Name Description
    System.String seq
    System.Int32 index
    System.Int32 codePointOffset
    Returns
    Type Description
    System.Int32
    | Improve this Doc View Source

    ToBytesRefArray(String, Encoding)

    Declaration
    public static BytesRef ToBytesRefArray(this string str, Encoding enc)
    Parameters
    Type Name Description
    System.String str
    Encoding enc
    Returns
    Type Description
    BytesRef
    | Improve this Doc View Source

    ToCharSequence(String)

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

    Declaration
    public static ICharSequence ToCharSequence(this string str)
    Parameters
    Type Name Description
    System.String str
    Returns
    Type Description
    ICharSequence
    | Improve this Doc View Source

    TrimEnd(String[])

    Removes null or empty elements from the end of a string array.

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

    This string array.

    Returns
    Type Description
    System.String[]

    The array with any null or empty elements removed from the end.

    • Improve this Doc
    • View Source
    Back to top Copyright © 2020 Licensed to the Apache Software Foundation (ASF)