Table of Contents

FormatNonAlloc Method

FormatNonAlloc(string, SpanList<char>, SpanList<char>, bool)

public static string FormatNonAlloc(this string template, SpanList<char> tokens, SpanList<char> replacements, bool clearArrayPoolBuffer = false)

Batch replace with no unnecessary memory allocation.

Parameters

template string
tokens SpanList<char>

Tokens must start wtih { and end with }.

replacements SpanList<char>
clearArrayPoolBuffer bool

true to fill shared buffer by default value when return buffer to ArrayPool<T>.

Returns

string

FormatNonAlloc(ReadOnlySpan<char>, SpanList<char>, SpanList<char>, bool)

public static string FormatNonAlloc(this ReadOnlySpan<char> template, SpanList<char> tokens, SpanList<char> replacements, bool clearArrayPoolBuffer = false)

Batch replace with no unnecessary memory allocation.

Parameters

template ReadOnlySpan<char>
tokens SpanList<char>

Tokens must start wtih { and end with }.

replacements SpanList<char>
clearArrayPoolBuffer bool

true to fill shared buffer by default value when return buffer to ArrayPool<T>.

Returns

string