Table of Contents

Class StringBuilderDebug2

Namespace
SunamoDebugging.System.Text
Assembly
SunamoDebugging.dll

An advanced StringBuilder implementation with validation, formatting, and conditional append support for debugging. Commonly used for JavaScript code generation with line-by-line tracking and syntax validation.

public class StringBuilderDebug2 : DebugStringBuilderAbstract<StringBuilderDebug2>
Inheritance
StringBuilderDebug2
Inherited Members
Extension Methods

Constructors

StringBuilderDebug2()

Initializes a new instance of the StringBuilderDebug2 class without validation.

public StringBuilderDebug2()

StringBuilderDebug2(Func<string, bool>, Action<StringBuilder>, Func<StringBuilder, string, bool>)

Initializes a new instance of the StringBuilderDebug2 class with validation and processing support.

public StringBuilderDebug2(Func<string, bool> checkValidity, Action<StringBuilder> processBeforeValidity, Func<StringBuilder, string, bool> canAppend)

Parameters

checkValidity Func<string, bool>

A function that validates the content and returns true if valid.

processBeforeValidity Action<StringBuilder>

An action to process the StringBuilder before validation.

canAppend Func<StringBuilder, string, bool>

A function that determines whether a value can be appended.

Properties

ActualJavaScriptAfterFormattingFilePath

Gets or sets the file path where the actual JavaScript content is written after formatting (DEBUG only).

public string? ActualJavaScriptAfterFormattingFilePath { get; set; }

Property Value

string

ActualJavaScriptBeforeFormattingFilePath

Gets or sets the file path where the actual JavaScript content is written before formatting (DEBUG only).

public string? ActualJavaScriptBeforeFormattingFilePath { get; set; }

Property Value

string

ActualLine

Gets or sets the current line number being processed.

public int ActualLine { get; set; }

Property Value

int

CaptureForAdding

Gets or sets a list of search terms to capture for debugging purposes. When any appended value contains these terms, a breakpoint can be triggered.

public static List<string>? CaptureForAdding { get; set; }

Property Value

List<string>

LastWrittenLine

Gets or sets the line number that was last written to the builder.

public int LastWrittenLine { get; set; }

Property Value

int

Methods

Append(string)

Appends a string to the content, then validates it.

public override StringBuilderDebug2 Append(string value)

Parameters

value string

The string to append.

Returns

StringBuilderDebug2

The current instance for method chaining.

AppendLine()

Appends a line terminator to the content.

public override StringBuilderDebug2 AppendLine()

Returns

StringBuilderDebug2

The current instance for method chaining.

AppendLine(string)

Appends a string followed by a line terminator to the content, then validates it.

public override StringBuilderDebug2 AppendLine(string value)

Parameters

value string

The string to append.

Returns

StringBuilderDebug2

The current instance for method chaining.

CheckValidity()

Validates the current content using the validation function provided in the constructor.

public void CheckValidity()

Clear()

Clears all content from the builder.

public override StringBuilderDebug2 Clear()

Returns

StringBuilderDebug2

The current instance for method chaining.

ToString()

Returns the current content as a string.

public override string ToString()

Returns

string

The current content.