Class StringBuilderExtensions
Inheritance
Namespace: Lucene.Net.Support
Assembly: Lucene.Net.dll
Syntax
public static class StringBuilderExtensions : object
Methods
| Improve this Doc View SourceAppendCodePoint(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 Char
The overall effect is exactly as if the argument were
converted to a
Declaration
public static StringBuilder AppendCodePoint(this StringBuilder text, int codePoint)
Parameters
Type | Name | Description |
---|---|---|
String |
text | This |
System. |
codePoint | a Unicode code point |
Returns
Type | Description |
---|---|
String |
a reference to this object. |
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 |
---|---|---|
String |
text | this |
System. |
index | the index to the char values |
Returns
Type | Description |
---|---|
System. |
the code point value of the character at the index |
CodePointCount(StringBuilder, Int32, Int32)
Returns the number of Unicode code points in the specified text
range of this beginIndex
and extends to the endIndex - 1
. Thus the length (in
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 |
---|---|---|
String |
text | this |
System. |
beginIndex | the index to the first |
System. |
endIndex | the index after the last |
Returns
Type | Description |
---|---|
System. |
the number of Unicode code points in the specified text range. |
GetChars(StringBuilder)
Copies the array from the
Declaration
public static char[] GetChars(this StringBuilder text)
Parameters
Type | Name | Description |
---|---|---|
String |
text | this |
Returns
Type | Description |
---|---|
System. |
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 |
---|---|---|
String |
text | This |
System. |
value | The string to find. |
Returns
Type | Description |
---|---|
System. |
The index of the specified character, or -1 if the character isn't found. |
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 |
---|---|---|
String |
text | This |
System. |
value | The string to find. |
System. |
startIndex | The starting offset. |
Returns
Type | Description |
---|---|
System. |
The index of the specified character, or -1 if the character isn't found. |
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 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 |
---|---|---|
String |
text | this |
Returns
Type | Description |
---|---|
String |
a reference to this |
ToCharSequence(StringBuilder)
Convenience method to wrap a string in a String
Declaration
public static ICharSequence ToCharSequence(this StringBuilder text)
Parameters
Type | Name | Description |
---|---|---|
String |
text |
Returns
Type | Description |
---|---|
IChar |