Class StringInterpolation
Provides factory methods to create interpolated strings efficiently.
Inherited Members
Namespace: DotNext.Text
Assembly: DotNext.dll
Syntax
public static class StringInterpolation
Methods
View SourceInterpolate(ref BufferWriterSlim<byte>, Encoder, scoped Span<char>, scoped in BufferWriterSlimEncodingInterpolatedStringHandler)
Encodes formattable string as a sequence of bytes.
Declaration
public static int Interpolate(this ref BufferWriterSlim<byte> writer, Encoder encoder, scoped Span<char> buffer, scoped in BufferWriterSlimEncodingInterpolatedStringHandler handler)
Parameters
| Type | Name | Description |
|---|---|---|
| BufferWriterSlim<byte> | writer | The output buffer. |
| Encoder | encoder | The encoding context. |
| Span<char> | buffer | The preallocated buffer to be used for placing characters during encoding. |
| BufferWriterSlimEncodingInterpolatedStringHandler | handler | The interpolated string handler. |
Returns
| Type | Description |
|---|---|
| int | The number of produced bytes. |
Interpolate(ref BufferWriterSlim<byte>, Encoder, scoped Span<char>, IFormatProvider?, scoped in BufferWriterSlimEncodingInterpolatedStringHandler)
Encodes formattable string as a sequence of bytes.
Declaration
public static int Interpolate(this ref BufferWriterSlim<byte> writer, Encoder encoder, scoped Span<char> buffer, IFormatProvider? provider, scoped in BufferWriterSlimEncodingInterpolatedStringHandler handler)
Parameters
| Type | Name | Description |
|---|---|---|
| BufferWriterSlim<byte> | writer | The output buffer. |
| Encoder | encoder | The encoding context. |
| Span<char> | buffer | The preallocated buffer to be used for placing characters during encoding. |
| IFormatProvider | provider | The format provider. |
| BufferWriterSlimEncodingInterpolatedStringHandler | handler | The interpolated string handler. |
Returns
| Type | Description |
|---|---|
| int | The number of produced bytes. |
Interpolate(ref BufferWriterSlim<char>, scoped in BufferWriterSlimInterpolatedStringHandler)
Writes interpolated string to the buffer.
Declaration
public static int Interpolate(this ref BufferWriterSlim<char> writer, scoped in BufferWriterSlimInterpolatedStringHandler handler)
Parameters
| Type | Name | Description |
|---|---|---|
| BufferWriterSlim<char> | writer | The buffer writer. |
| BufferWriterSlimInterpolatedStringHandler | handler | The handler of the interpolated string. |
Returns
| Type | Description |
|---|---|
| int | The number of written characters. |
Interpolate(ref BufferWriterSlim<char>, IFormatProvider?, scoped in BufferWriterSlimInterpolatedStringHandler)
Writes interpolated string to the buffer.
Declaration
public static int Interpolate(this ref BufferWriterSlim<char> writer, IFormatProvider? provider, scoped in BufferWriterSlimInterpolatedStringHandler handler)
Parameters
| Type | Name | Description |
|---|---|---|
| BufferWriterSlim<char> | writer | The buffer writer. |
| IFormatProvider | provider | The formatting provider. |
| BufferWriterSlimInterpolatedStringHandler | handler | The handler of the interpolated string. |
Returns
| Type | Description |
|---|---|
| int | The number of written characters. |
Interpolate(MemoryAllocator<byte>?, Encoder, Span<char>, scoped ref EncodingInterpolatedStringHandler)
Formats interpolated string as a rented buffer of characters.
Declaration
public static MemoryOwner<byte> Interpolate(MemoryAllocator<byte>? allocator, Encoder encoder, Span<char> buffer, scoped ref EncodingInterpolatedStringHandler handler)
Parameters
| Type | Name | Description |
|---|---|---|
| MemoryAllocator<byte> | allocator | The allocator of the interpolated string. |
| Encoder | encoder | The encoding context. |
| Span<char> | buffer | The preallocated buffer to be used for placing characters during encoding. |
| EncodingInterpolatedStringHandler | handler | The interpolated string handler. |
Returns
| Type | Description |
|---|---|
| MemoryOwner<byte> | A buffer containing formatted string. |
Interpolate(MemoryAllocator<byte>?, Encoder, Span<char>, IFormatProvider?, scoped ref EncodingInterpolatedStringHandler)
Formats interpolated string as a rented buffer of characters.
Declaration
public static MemoryOwner<byte> Interpolate(MemoryAllocator<byte>? allocator, Encoder encoder, Span<char> buffer, IFormatProvider? provider, scoped ref EncodingInterpolatedStringHandler handler)
Parameters
| Type | Name | Description |
|---|---|---|
| MemoryAllocator<byte> | allocator | The allocator of the interpolated string. |
| Encoder | encoder | The encoding context. |
| Span<char> | buffer | The preallocated buffer to be used for placing characters during encoding. |
| IFormatProvider | provider | Optional formatting provider to be applied for each interpolated string argument. |
| EncodingInterpolatedStringHandler | handler | The interpolated string handler. |
Returns
| Type | Description |
|---|---|
| MemoryOwner<byte> | A buffer containing formatted string. |
Interpolate(MemoryAllocator<char>?, ref PoolingInterpolatedStringHandler)
Formats interpolated string as a rented buffer of characters.
Declaration
public static MemoryOwner<char> Interpolate(MemoryAllocator<char>? allocator, ref PoolingInterpolatedStringHandler handler)
Parameters
| Type | Name | Description |
|---|---|---|
| MemoryAllocator<char> | allocator | The allocator of the interpolated string. |
| PoolingInterpolatedStringHandler | handler | The interpolated string handler. |
Returns
| Type | Description |
|---|---|
| MemoryOwner<char> | A buffer containing formatted string. |
Interpolate(MemoryAllocator<char>?, IFormatProvider?, ref PoolingInterpolatedStringHandler)
Formats interpolated string as a rented buffer of characters.
Declaration
public static MemoryOwner<char> Interpolate(MemoryAllocator<char>? allocator, IFormatProvider? provider, ref PoolingInterpolatedStringHandler handler)
Parameters
| Type | Name | Description |
|---|---|---|
| MemoryAllocator<char> | allocator | The allocator of the interpolated string. |
| IFormatProvider | provider | Optional formatting provider to be applied for each interpolated string argument. |
| PoolingInterpolatedStringHandler | handler | The interpolated string handler. |
Returns
| Type | Description |
|---|---|
| MemoryOwner<char> | A buffer containing formatted string. |
Interpolate(IBufferWriter<byte>, Encoder, Span<char>, in BufferWriterEncodingInterpolatedStringHandler)
Encodes formattable string as a sequence of bytes.
Declaration
public static int Interpolate(this IBufferWriter<byte> writer, Encoder encoder, Span<char> buffer, in BufferWriterEncodingInterpolatedStringHandler handler)
Parameters
| Type | Name | Description |
|---|---|---|
| IBufferWriter<byte> | writer | The output buffer. |
| Encoder | encoder | The encoding context. |
| Span<char> | buffer | The preallocated buffer to be used for placing characters during encoding. |
| BufferWriterEncodingInterpolatedStringHandler | handler | The interpolated string handler. |
Returns
| Type | Description |
|---|---|
| int | The number of produced bytes. |
Interpolate(IBufferWriter<byte>, Encoder, Span<char>, IFormatProvider?, in BufferWriterEncodingInterpolatedStringHandler)
Encodes formattable string as a sequence of bytes.
Declaration
public static int Interpolate(this IBufferWriter<byte> writer, Encoder encoder, Span<char> buffer, IFormatProvider? provider, in BufferWriterEncodingInterpolatedStringHandler handler)
Parameters
| Type | Name | Description |
|---|---|---|
| IBufferWriter<byte> | writer | The output buffer. |
| Encoder | encoder | The encoding context. |
| Span<char> | buffer | The preallocated buffer to be used for placing characters during encoding. |
| IFormatProvider | provider | The format provider. |
| BufferWriterEncodingInterpolatedStringHandler | handler | The interpolated string handler. |
Returns
| Type | Description |
|---|---|
| int | The number of produced bytes. |
Interpolate(IBufferWriter<char>, in BufferWriterInterpolatedStringHandler)
Writes interpolated string to the buffer.
Declaration
public static int Interpolate(this IBufferWriter<char> writer, in BufferWriterInterpolatedStringHandler handler)
Parameters
| Type | Name | Description |
|---|---|---|
| IBufferWriter<char> | writer | The buffer writer. |
| BufferWriterInterpolatedStringHandler | handler | The handler of the interpolated string. |
Returns
| Type | Description |
|---|---|
| int | The number of written characters. |
Interpolate(IBufferWriter<char>, IFormatProvider?, in BufferWriterInterpolatedStringHandler)
Writes interpolated string to the buffer.
Declaration
public static int Interpolate(this IBufferWriter<char> writer, IFormatProvider? provider, in BufferWriterInterpolatedStringHandler handler)
Parameters
| Type | Name | Description |
|---|---|---|
| IBufferWriter<char> | writer | The buffer writer. |
| IFormatProvider | provider | The formatting provider. |
| BufferWriterInterpolatedStringHandler | handler | The handler of the interpolated string. |
Returns
| Type | Description |
|---|---|
| int | The number of written characters. |