Class StringExtensions
Inheritance
System.Object
StringExtensions
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Assembly: Lucene.Net.dll
Syntax
public static class StringExtensions
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 System.String. The text range begins at the
specified beginIndex
and extends to the
System.Char at index endIndex - 1
. Thus the
length (in System.Chars) 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 System.Char of the text range.
|
System.Int32 |
endIndex |
the index after the last System.Char of the text range.
|
Returns
Type |
Description |
System.Int32 |
the number of Unicode code points in the specified text range
|
Exceptions
Type |
Condition |
System.IndexOutOfRangeException |
if the beginIndex is negative, or
endIndex is larger than the length of this System.String, or
beginIndex is larger than endIndex .
|
|
Improve this Doc
View Source
CompareToOrdinal(String, String)
This method mimics the Java String.compareTo(String) method in that it
- Compares the strings using lexographic sorting rules
- 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 |
|
System.Text.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 |
|
System.Text.Encoding |
enc |
|
Returns
|
Improve this Doc
View Source
ToCharSequence(String)
Declaration
public static ICharSequence ToCharSequence(this string str)
Parameters
Type |
Name |
Description |
System.String |
str |
|
Returns
|
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.
|