Struct ValueStringBuilder
A string builder which minimizes as many heap allocations as possible.
Implements
Inherited Members
Namespace: LinkDotNet.StringBuilder
Assembly: LinkDotNet.StringBuilder.dll
Syntax
public ref struct ValueStringBuilder
Remarks
This is a ref struct which has certain limitations. You can only store it in a local variable or another ref struct.
You should dispose it after use to ensure the rented buffer is returned to the array pool.
Constructors
| Improve this Doc View SourceValueStringBuilder()
Initializes a new instance of the Value
Declaration
public ValueStringBuilder()
ValueStringBuilder(ReadOnlySpan<Char>)
Initializes a new instance of the Value
Declaration
public ValueStringBuilder(ReadOnlySpan<char> initialText)
Parameters
Type | Name | Description |
---|---|---|
Read |
initialText | The initial text used to initialize this instance. |
ValueStringBuilder(Span<Char>)
Initializes a new instance of the Value
Declaration
public ValueStringBuilder(Span<char> initialBuffer)
Parameters
Type | Name | Description |
---|---|---|
Span<System. |
initialBuffer | Initial buffer for the string builder to begin with. |
ValueStringBuilder(Int32)
Initializes a new instance of the Value
Declaration
public ValueStringBuilder(int initialCapacity)
Parameters
Type | Name | Description |
---|---|---|
System. |
initialCapacity | The initial capacity that will be allocated for this instance. |
Properties
| Improve this Doc View SourceCapacity
Gets the current maximum capacity before the span must be resized.
Declaration
public readonly int Capacity { get; }
Property Value
Type | Description |
---|---|
System. |
The current maximum capacity before the span must be resized. |
Item[Int32]
Returns the character at the given index or throws an
Declaration
public readonly ref char this[int index] { get; }
Parameters
Type | Name | Description |
---|---|---|
System. |
index | Character position to be retrieved. |
Property Value
Type | Description |
---|---|
System. |
Length
Gets the current length of the represented string.
Declaration
public readonly int Length { get; }
Property Value
Type | Description |
---|---|
System. |
The current length of the represented string. |
Methods
| Improve this Doc View SourceAppend(ReadOnlyMemory<Char>)
Appends a slice of memory.
Declaration
public void Append(ReadOnlyMemory<char> memory)
Parameters
Type | Name | Description |
---|---|---|
Read |
memory | The memory to add. |
Append(scoped, Char, str)
Appends a string.
Declaration
public void Append(scoped ReadOnlySpan, char, str)
Parameters
Type | Name | Description |
---|---|---|
scoped | ReadOnlySpan | |
System. |
||
str |
Append(Boolean)
Appends the string representation of the boolean.
Declaration
public void Append(bool value)
Parameters
Type | Name | Description |
---|---|---|
System. |
value | Bool value to add. |
Append(Char)
Appends a single character.
Declaration
public void Append(char value)
Parameters
Type | Name | Description |
---|---|---|
System. |
value | Character to add. |
Append(Char*, Int32)
Appends a character buffer.
Declaration
public void Append(char *value, int length)
Parameters
Type | Name | Description |
---|---|---|
System. |
value | The pointer to the start of the buffer. |
System. |
length | The number of characters in the buffer. |
Append(Rune)
Appends a single rune to the string builder.
Declaration
public void Append(Rune value)
Parameters
Type | Name | Description |
---|---|---|
System. |
value | Rune to add. |
Append<T>(T, ReadOnlySpan<Char>, Int32)
Appends the string representation of the value.
Declaration
public void Append<T>(T value, ReadOnlySpan<char> format = null, int bufferSize = 36)
where T : ISpanFormattable
Parameters
Type | Name | Description |
---|---|---|
T | value | Formattable span to add. |
Read |
format | Optional formatter. If not provided the default of the given instance is taken. |
System. |
bufferSize | Size of the buffer allocated. If you have a custom type that implements |
Type Parameters
Name | Description |
---|---|
T | Any |
AppendFormat<T>(ReadOnlySpan<Char>, T)
Appends the format string to the given Value
Declaration
public void AppendFormat<T>(ReadOnlySpan<char> format, T arg)
Parameters
Type | Name | Description |
---|---|---|
Read |
format | Format string. |
T | arg | Argument for |
Type Parameters
Name | Description |
---|---|
T | Any type. |
Remarks
The current version does not allow for a custom format. So:
AppendFormat("{0:00}")
is not allowed and will result in an exception.
AppendFormat<T1, T2>(ReadOnlySpan<Char>, T1, T2)
Appends the format string to the given Value
Declaration
public void AppendFormat<T1, T2>(ReadOnlySpan<char> format, T1 arg1, T2 arg2)
Parameters
Type | Name | Description |
---|---|---|
Read |
format | Format string. |
T1 | arg1 | Argument for |
T2 | arg2 | Argument for |
Type Parameters
Name | Description |
---|---|
T1 | Any type for |
T2 | Any type for |
Remarks
The current version does not allow for a custom format. So:
AppendFormat("{0:00}")
is not allowed and will result in an exception.
AppendFormat<T1, T2, T3>(ReadOnlySpan<Char>, T1, T2, T3)
Appends the format string to the given Value
Declaration
public void AppendFormat<T1, T2, T3>(ReadOnlySpan<char> format, T1 arg1, T2 arg2, T3 arg3)
Parameters
Type | Name | Description |
---|---|---|
Read |
format | Format string. |
T1 | arg1 | Argument for |
T2 | arg2 | Argument for |
T3 | arg3 | Argument for |
Type Parameters
Name | Description |
---|---|
T1 | Any type for |
T2 | Any type for |
T3 | Any type for |
Remarks
The current version does not allow for a custom format. So:
AppendFormat("{0:00}")
is not allowed and will result in an exception.
AppendFormat<T1, T2, T3, T4>(ReadOnlySpan<Char>, T1, T2, T3, T4)
Appends the format string to the given Value
Declaration
public void AppendFormat<T1, T2, T3, T4>(ReadOnlySpan<char> format, T1 arg1, T2 arg2, T3 arg3, T4 arg4)
Parameters
Type | Name | Description |
---|---|---|
Read |
format | Format string. |
T1 | arg1 | Argument for |
T2 | arg2 | Argument for |
T3 | arg3 | Argument for |
T4 | arg4 | Argument for |
Type Parameters
Name | Description |
---|---|
T1 | Any type for |
T2 | Any type for |
T3 | Any type for |
T4 | Any type for |
Remarks
The current version does not allow for a custom format. So:
AppendFormat("{0:00}")
is not allowed and will result in an exception.
AppendFormat<T1, T2, T3, T4, T5>(ReadOnlySpan<Char>, T1, T2, T3, T4, T5)
Appends the format string to the given Value
Declaration
public void AppendFormat<T1, T2, T3, T4, T5>(ReadOnlySpan<char> format, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5)
Parameters
Type | Name | Description |
---|---|---|
Read |
format | Format string. |
T1 | arg1 | Argument for |
T2 | arg2 | Argument for |
T3 | arg3 | Argument for |
T4 | arg4 | Argument for |
T5 | arg5 | Argument for |
Type Parameters
Name | Description |
---|---|
T1 | Any type for |
T2 | Any type for |
T3 | Any type for |
T4 | Any type for |
T5 | Any type for |
Remarks
The current version does not allow for a custom format. So:
AppendFormat("{0:00}")
is not allowed and will result in an exception.
AppendJoin(ReadOnlySpan<Char>, IEnumerable<String>)
Concatenates and appends all values with the given separator between each entry at the end of the string.
Declaration
public void AppendJoin(ReadOnlySpan<char> separator, IEnumerable<string> values)
Parameters
Type | Name | Description |
---|---|---|
Read |
separator | String used as separator between the entries. |
IEnumerable<System. |
values | Enumerable of strings to be concatenated. |
AppendJoin(Char, IEnumerable<String>)
Concatenates and appends all values with the given separator between each entry at the end of the string.
Declaration
public void AppendJoin(char separator, IEnumerable<string> values)
Parameters
Type | Name | Description |
---|---|---|
System. |
separator | Character used as separator between the entries. |
IEnumerable<System. |
values | Enumerable of strings to be concatenated. |
AppendJoin(Rune, IEnumerable<String>)
Concatenates and appends all values with the given separator between each entry at the end of the string.
Declaration
public void AppendJoin(Rune separator, IEnumerable<string> values)
Parameters
Type | Name | Description |
---|---|---|
System. |
separator | Rune used as separator between the entries. |
IEnumerable<System. |
values | Enumerable of strings to be concatenated. |
AppendJoin<T>(ReadOnlySpan<Char>, IEnumerable<T>)
Concatenates and appends all values with the given separator between each entry at the end of the string.
Declaration
public void AppendJoin<T>(ReadOnlySpan<char> separator, IEnumerable<T> values)
Parameters
Type | Name | Description |
---|---|---|
Read |
separator | String used as separator between the entries. |
IEnumerable<T> | values | Enumerable to be concatenated. |
Type Parameters
Name | Description |
---|---|
T | Type of the given enumerable. |
AppendJoin<T>(Char, IEnumerable<T>)
Concatenates and appends all values with the given separator between each entry at the end of the string.
Declaration
public void AppendJoin<T>(char separator, IEnumerable<T> values)
Parameters
Type | Name | Description |
---|---|---|
System. |
separator | Character used as separator between the entries. |
IEnumerable<T> | values | Enumerable to be concatenated. |
Type Parameters
Name | Description |
---|---|
T | Type of the given enumerable. |
AppendJoin<T>(Rune, IEnumerable<T>)
Concatenates and appends all values with the given separator between each entry at the end of the string.
Declaration
public void AppendJoin<T>(Rune separator, IEnumerable<T> values)
Parameters
Type | Name | Description |
---|---|---|
System. |
separator | Rune used as separator between the entries. |
IEnumerable<T> | values | Enumerable to be concatenated. |
Type Parameters
Name | Description |
---|---|
T | Type of the given enumerable. |
AppendLine()
Appends
Declaration
public void AppendLine()
AppendLine(scoped, Char, str)
Calls
Declaration
public void AppendLine(scoped ReadOnlySpan, char, str)
Parameters
Type | Name | Description |
---|---|---|
scoped | ReadOnlySpan | |
System. |
||
str |
AppendSpan(Int32)
Appends a span of the given length, which can be written to later.
Declaration
public Span<char> AppendSpan(int length)
Parameters
Type | Name | Description |
---|---|---|
System. |
length | Integer representing the number of characters to be appended. |
Returns
Type | Description |
---|---|
Span<System. |
A span with the characters appended. |
AsSpan()
Returns the string as an
Declaration
public readonly ReadOnlySpan<char> AsSpan()
Returns
Type | Description |
---|---|
Read |
The filled array as |
AsSpan(Range)
Returns the string as an
Declaration
public readonly ReadOnlySpan<char> AsSpan(Range range)
Parameters
Type | Name | Description |
---|---|---|
Range | range | The range to be retrieved. |
Returns
Type | Description |
---|---|
Read |
The filled array as |
AsSpan(Int32)
Returns the string as an
Declaration
public readonly ReadOnlySpan<char> AsSpan(int startIndex)
Parameters
Type | Name | Description |
---|---|---|
System. |
startIndex | The starting position of the substring in this instance. |
Returns
Type | Description |
---|---|
Read |
The filled array as |
AsSpan(Int32, Int32)
Returns the string as an
Declaration
public readonly ReadOnlySpan<char> AsSpan(int startIndex, int length)
Parameters
Type | Name | Description |
---|---|---|
System. |
startIndex | The starting position of the substring in this instance. |
System. |
length | The length of the substring. |
Returns
Type | Description |
---|---|
Read |
The filled array as |
Clear()
Clears the internal representation of the string.
Declaration
public void Clear()
Remarks
This will not enforce some re-allocation or shrinking of the internal buffer. The size stays the same.
Concat<T>(T[])
Concatenates multiple objects together.
Declaration
public static string Concat<T>(params T[] values)
Parameters
Type | Name | Description |
---|---|---|
T[] | values | Values to be concatenated together. |
Returns
Type | Description |
---|---|
System. |
Concatenated string or an empty string if |
Type Parameters
Name | Description |
---|---|
T | Any given type, which can be translated to System. |
Concat<T1, T2>(T1, T2)
Concatenates two different types together.
Declaration
public static string Concat<T1, T2>(T1 arg1, T2 arg2)
Parameters
Type | Name | Description |
---|---|---|
T1 | arg1 | First argument. |
T2 | arg2 | Second argument. |
Returns
Type | Description |
---|---|
System. |
String representation of the concateneted result. |
Type Parameters
Name | Description |
---|---|
T1 | Typeparameter of |
T2 | Typeparameter of |
Concat<T1, T2, T3>(T1, T2, T3)
Concatenates two different types together.
Declaration
public static string Concat<T1, T2, T3>(T1 arg1, T2 arg2, T3 arg3)
Parameters
Type | Name | Description |
---|---|---|
T1 | arg1 | First argument. |
T2 | arg2 | Second argument. |
T3 | arg3 | Third argument. |
Returns
Type | Description |
---|---|
System. |
String representation of the concateneted result. |
Type Parameters
Name | Description |
---|---|
T1 | Typeparameter of |
T2 | Typeparameter of |
T3 | Typeparameter of |
Concat<T1, T2, T3, T4>(T1, T2, T3, T4)
Concatenates two different types together.
Declaration
public static string Concat<T1, T2, T3, T4>(T1 arg1, T2 arg2, T3 arg3, T4 arg4)
Parameters
Type | Name | Description |
---|---|---|
T1 | arg1 | First argument. |
T2 | arg2 | Second argument. |
T3 | arg3 | Third argument. |
T4 | arg4 | Fourth argument. |
Returns
Type | Description |
---|---|
System. |
String representation of the concateneted result. |
Type Parameters
Name | Description |
---|---|
T1 | Typeparameter of |
T2 | Typeparameter of |
T3 | Typeparameter of |
T4 | Typeparameter of |
Concat<T1, T2, T3, T4, T5>(T1, T2, T3, T4, T5)
Concatenates two different types together.
Declaration
public static string Concat<T1, T2, T3, T4, T5>(T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5)
Parameters
Type | Name | Description |
---|---|---|
T1 | arg1 | First argument. |
T2 | arg2 | Second argument. |
T3 | arg3 | Third argument. |
T4 | arg4 | Fourth argument. |
T5 | arg5 | Fifth argument. |
Returns
Type | Description |
---|---|
System. |
String representation of the concateneted result. |
Type Parameters
Name | Description |
---|---|
T1 | Typeparameter of |
T2 | Typeparameter of |
T3 | Typeparameter of |
T4 | Typeparameter of |
T5 | Typeparameter of |
Contains(ReadOnlySpan<Char>)
Returns whether a specified substring occurs within this string.
Declaration
public readonly bool Contains(ReadOnlySpan<char> word)
Parameters
Type | Name | Description |
---|---|---|
Read |
word | Word to look for in this string. |
Returns
Type | Description |
---|---|
System. |
True if the value parameter occurs within this string, or if value is the empty string (""); otherwise, false. |
Remarks
This method performs an ordinal (case-sensitive and culture-insensitive) comparison.
Dispose()
Disposes the instance and returns the rented buffer to the array pool if needed.
Declaration
public void Dispose()
EnsureCapacity(Int32)
Ensures the builder's buffer size is at least newCapacity
, renting a larger buffer if not.
Declaration
public void EnsureCapacity(int newCapacity)
Parameters
Type | Name | Description |
---|---|---|
System. |
newCapacity | New capacity for the builder. |
Remarks
If Length is already >= newCapacity
, nothing is done.
Equals(ReadOnlySpan<Char>)
Returns whether the characters in this builder are equal to the characters in the given span.
Declaration
public readonly bool Equals(ReadOnlySpan<char> span)
Parameters
Type | Name | Description |
---|---|---|
Read |
span | The character span to compare with the current instance. |
Returns
Type | Description |
---|---|
System. |
true if the characters are equal to this instance, otherwise false. |
Equals(ReadOnlySpan<Char>, StringComparison)
Returns whether the characters in this builder are equal to the characters in the given span according to the given comparison type.
Declaration
public readonly bool Equals(ReadOnlySpan<char> span, StringComparison comparisonType)
Parameters
Type | Name | Description |
---|---|---|
Read |
span | The character span to compare with the current instance. |
String |
comparisonType | The way to compare the sequences of characters. |
Returns
Type | Description |
---|---|
System. |
true if the characters are equal to this instance, otherwise false. |
GetEnumerator()
Creates an enumerator over the characters in the builder.
Declaration
public readonly ValueStringBuilder.Enumerator GetEnumerator()
Returns
Type | Description |
---|---|
Value |
An enumerator over the characters in the builder. |
GetPinnableReference()
Gets a pinnable reference to the represented string from this builder. The content after Length is not guaranteed to be null terminated.
Declaration
public readonly ref char GetPinnableReference()
Returns
Type | Description |
---|---|
System. |
The pointer to the first instance of the string represented by this builder. |
Remarks
This method is used for use-cases where the user wants to use "fixed" calls like the following:
using var stringBuilder = new ValueStringBuilder();
stringBuilder.Append("Hello World");
fixed (var* buffer = stringBuilder) { ... }
IndexOf(ReadOnlySpan<Char>)
Returns the index within this string of the first occurrence of the specified substring.
Declaration
public readonly int IndexOf(ReadOnlySpan<char> word)
Parameters
Type | Name | Description |
---|---|---|
Read |
word | Word to look for in this string. |
Returns
Type | Description |
---|---|
System. |
The index of the found |
IndexOf(ReadOnlySpan<Char>, Int32)
Returns the index within this string of the first occurrence of the specified substring, starting at the specified index.
Declaration
public readonly int IndexOf(ReadOnlySpan<char> word, int startIndex)
Parameters
Type | Name | Description |
---|---|---|
Read |
word | Word to look for in this string. |
System. |
startIndex | Index to begin with. |
Returns
Type | Description |
---|---|
System. |
The index of the found |
Insert(Int32, scoped, Char, value)
Appends the string representation of the boolean to the builder.
Declaration
public void Insert(int index, scoped ReadOnlySpan, char, value)
Parameters
Type | Name | Description |
---|---|---|
System. |
index | Index where |
scoped | ReadOnlySpan | |
System. |
||
value |
Insert(Int32, Boolean)
Insert the string representation of the boolean to the builder at the given index.
Declaration
public void Insert(int index, bool value)
Parameters
Type | Name | Description |
---|---|---|
System. |
index | Index where |
System. |
value | Boolean to insert into this builder. |
Insert(Int32, Char)
Insert the string representation of the character to the builder at the given index.
Declaration
public void Insert(int index, char value)
Parameters
Type | Name | Description |
---|---|---|
System. |
index | Index where |
System. |
value | Character to insert into this builder. |
Insert(Int32, Rune)
Insert the string representation of the rune to the builder at the given index.
Declaration
public void Insert(int index, Rune value)
Parameters
Type | Name | Description |
---|---|---|
System. |
index | Index where |
System. |
value | Rune to insert into this builder. |
Insert<T>(Int32, T, scoped, Char, format, Int32)
Insert the string representation of the char to the builder at the given index.
Declaration
public void Insert<T>(int index, T value, scoped ReadOnlySpan, char, format = null, int bufferSize = 36)
where T : ISpanFormattable
Parameters
Type | Name | Description |
---|---|---|
System. |
index | Index where |
T | value | Formattable span to insert into this builder. |
scoped | ReadOnlySpan | |
System. |
||
format | ||
System. |
bufferSize | Size of the buffer allocated on the stack. |
Type Parameters
Name | Description |
---|---|
T | Any |
LastIndexOf(ReadOnlySpan<Char>)
Returns the index within this string of the last occurrence of the specified substring.
Declaration
public readonly int LastIndexOf(ReadOnlySpan<char> word)
Parameters
Type | Name | Description |
---|---|---|
Read |
word | Word to look for in this string. |
Returns
Type | Description |
---|---|
System. |
The index of the found |
LastIndexOf(ReadOnlySpan<Char>, Int32)
Returns the index within this string of the last occurrence of the specified substring, starting at the specified index.
Declaration
public readonly int LastIndexOf(ReadOnlySpan<char> word, int startIndex)
Parameters
Type | Name | Description |
---|---|---|
Read |
word | Word to look for in this string. |
System. |
startIndex | Index to begin with. |
Returns
Type | Description |
---|---|
System. |
The index of the found |
PadLeft(Int32, Char)
Pads the left side of the string with the given character.
Declaration
public void PadLeft(int totalWidth, char paddingChar)
Parameters
Type | Name | Description |
---|---|---|
System. |
totalWidth | Total width of the string after padding. |
System. |
paddingChar | Character to pad the string with. |
PadRight(Int32, Char)
Pads the right side of the string with the given character.
Declaration
public void PadRight(int totalWidth, char paddingChar)
Parameters
Type | Name | Description |
---|---|---|
System. |
totalWidth | Total width of the string after padding. |
System. |
paddingChar | Character to pad the string with. |
Remove(Int32, Int32)
Removes a range of characters from this builder.
Declaration
public void Remove(int startIndex, int length)
Parameters
Type | Name | Description |
---|---|---|
System. |
startIndex | The inclusive index from where the string gets removed. |
System. |
length | The length of the slice to remove. |
Remarks
This method will not affect the internal size of the string.
Replace(scoped, Char, oldValue, scoped, Char, newValue)
Replaces all instances of one string with another in this builder.
Declaration
public void Replace(scoped ReadOnlySpan, char, oldValue, scoped ReadOnlySpan, char, newValue)
Parameters
Type | Name | Description |
---|---|---|
scoped | ReadOnlySpan | |
System. |
||
old |
||
scoped | ReadOnlySpan | |
System. |
||
new |
Remarks
If newValue
is empty
, instances of oldValue
are removed.
Replace(scoped, Char, oldValue, scoped, Char, newValue, Int32, Int32)
Replaces all instances of one string with another in this builder.
Declaration
public void Replace(scoped ReadOnlySpan, char, oldValue, scoped ReadOnlySpan, char, newValue, int startIndex, int count)
Parameters
Type | Name | Description |
---|---|---|
scoped | ReadOnlySpan | |
System. |
||
old |
||
scoped | ReadOnlySpan | |
System. |
||
new |
||
System. |
startIndex | The index to start in this builder. |
System. |
count | The number of characters to read in this builder. |
Remarks
If newValue
is empty
, instances of oldValue
are removed.
Replace(Char, Char)
Replaces all instances of one character with another in this builder.
Declaration
public readonly void Replace(char oldValue, char newValue)
Parameters
Type | Name | Description |
---|---|---|
System. |
oldValue | The character to replace. |
System. |
newValue | The character to replace |
Replace(Char, Char, Int32, Int32)
Replaces all instances of one character with another in this builder.
Declaration
public readonly void Replace(char oldValue, char newValue, int startIndex, int count)
Parameters
Type | Name | Description |
---|---|---|
System. |
oldValue | The character to replace. |
System. |
newValue | The character to replace |
System. |
startIndex | The index to start in this builder. |
System. |
count | The number of characters to read in this builder. |
Replace(Rune, Rune)
Replaces all instances of one rune with another in this builder.
Declaration
public void Replace(Rune oldValue, Rune newValue)
Parameters
Type | Name | Description |
---|---|---|
System. |
oldValue | The rune to replace. |
System. |
newValue | The rune to replace |
Replace(Rune, Rune, Int32, Int32)
Replaces all instances of one rune with another in this builder.
Declaration
public void Replace(Rune oldValue, Rune newValue, int startIndex, int count)
Parameters
Type | Name | Description |
---|---|---|
System. |
oldValue | The rune to replace. |
System. |
newValue | The rune to replace |
System. |
startIndex | The index to start in this builder. |
System. |
count | The number of characters to read in this builder. |
ReplaceGeneric<T>(scoped, Char, oldValue, T)
Replaces all instances of one string with another in this builder.
Declaration
public void ReplaceGeneric<T>(scoped ReadOnlySpan, char, oldValue, T newValue)
Parameters
Type | Name | Description |
---|---|---|
scoped | ReadOnlySpan | |
System. |
||
old |
||
T | newValue | Object to replace |
Type Parameters
Name | Description |
---|---|
T | Any type. |
Remarks
If newValue
is from type
ReplaceGeneric<T>(scoped, Char, oldValue, T, Int32, Int32)
Replaces all instances of one string with another in this builder.
Declaration
public void ReplaceGeneric<T>(scoped ReadOnlySpan, char, oldValue, T newValue, int startIndex, int count)
Parameters
Type | Name | Description |
---|---|---|
scoped | ReadOnlySpan | |
System. |
||
old |
||
T | newValue | Object to replace |
System. |
startIndex | The index to start in this builder. |
System. |
count | The number of characters to read in this builder. |
Type Parameters
Name | Description |
---|---|
T | Any type. |
Remarks
If newValue
is TryFormat
is used.
Otherwise, ToString
is used.
Reverse()
Reverses the sequence of elements in this instance.
Declaration
public readonly void Reverse()
ToString()
Creates a System.
Declaration
public override readonly string ToString()
Returns
Type | Description |
---|---|
System. |
The System. |
Overrides
ToString(Range)
Creates a System.
Declaration
public readonly string ToString(Range range)
Parameters
Type | Name | Description |
---|---|---|
Range | range | The range to be retrieved. |
Returns
Type | Description |
---|---|
System. |
The System. |
ToString(Int32)
Creates a System.
Declaration
public readonly string ToString(int startIndex)
Parameters
Type | Name | Description |
---|---|---|
System. |
startIndex | The starting position of the substring in this instance. |
Returns
Type | Description |
---|---|
System. |
The System. |
ToString(Int32, Int32)
Creates a System.
Declaration
public readonly string ToString(int startIndex, int length)
Parameters
Type | Name | Description |
---|---|---|
System. |
startIndex | The starting position of the substring in this instance. |
System. |
length | The length of the substring. |
Returns
Type | Description |
---|---|
System. |
The System. |
Trim()
Removes all whitespace characters from the start and end of this builder.
Declaration
public void Trim()
Trim(Char)
Removes all occurrences of the specified character from the start and end of this builder.
Declaration
public void Trim(char value)
Parameters
Type | Name | Description |
---|---|---|
System. |
value | The character to remove. |
TrimEnd()
Removes all whitespace characters from the end of this builder.
Declaration
public void TrimEnd()
TrimEnd(Char)
Removes all occurrences of the specified character from the end of this builder.
Declaration
public void TrimEnd(char value)
Parameters
Type | Name | Description |
---|---|---|
System. |
value | The character to remove. |
TrimPrefix(ReadOnlySpan<Char>, StringComparison)
Removes the specified sequence of characters from the start of this builder.
Declaration
public void TrimPrefix(ReadOnlySpan<char> value, StringComparison comparisonType = null)
Parameters
Type | Name | Description |
---|---|---|
Read |
value | The sequence of characters to remove. |
String |
comparisonType | The way to compare the sequences of characters. |
TrimStart()
Removes all whitespace characters from the start of this builder.
Declaration
public void TrimStart()
TrimStart(Char)
Removes all occurrences of the specified character from the start of this builder.
Declaration
public void TrimStart(char value)
Parameters
Type | Name | Description |
---|---|---|
System. |
value | The character to remove. |
TrimSuffix(ReadOnlySpan<Char>, StringComparison)
Removes the specified sequence of characters from the end of this builder.
Declaration
public void TrimSuffix(ReadOnlySpan<char> value, StringComparison comparisonType = null)
Parameters
Type | Name | Description |
---|---|---|
Read |
value | The sequence of characters to remove. |
String |
comparisonType | The way to compare the sequences of characters. |
TryCopyTo(Span<Char>)
Tries to copy the represented string into the given
Declaration
public readonly bool TryCopyTo(Span<char> destination)
Parameters
Type | Name | Description |
---|---|---|
Span<System. |
destination | The destination where the internal string is copied into. |
Returns
Type | Description |
---|---|
System. |
True, if the copy was successful, otherwise false. |
Operators
| Improve this Doc View SourceImplicit(ReadOnlySpan<Char> to ValueStringBuilder)
Defines the implicit conversion of a
Declaration
public static implicit operator ValueStringBuilder(ReadOnlySpan<char> fromString)
Parameters
Type | Name | Description |
---|---|---|
Read |
fromString | The string as initial buffer. |
Returns
Type | Description |
---|---|
Value |
Implicit(String to ValueStringBuilder)
Defines the implicit conversion of a System.
Declaration
public static implicit operator ValueStringBuilder(string fromString)
Parameters
Type | Name | Description |
---|---|---|
System. |
fromString | The string as initial buffer. |
Returns
Type | Description |
---|---|
Value |