Table of Contents

Class StringBuilderDebug

Namespace
SunamoDebugging.System.Text
Assembly
SunamoDebugging.dll

A StringBuilder implementation with built-in validation support for debugging purposes. Commonly used for JavaScript code generation with real-time syntax validation.

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

Constructors

StringBuilderDebug()

Initializes a new instance of the StringBuilderDebug class without validation.

public StringBuilderDebug()

StringBuilderDebug(Func<string, bool>, Func<string, string>)

Initializes a new instance of the StringBuilderDebug class with validation support.

public StringBuilderDebug(Func<string, bool> checkValidity, Func<string, string> getFileAppData)

Parameters

checkValidity Func<string, bool>

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

getFileAppData Func<string, string>

A function that returns the path to the application data file for storing invalid content.

Properties

Length

Gets the current length of the content.

public int Length { get; }

Property Value

int

Methods

Append(string)

Appends a string to the content, then validates it.

public override StringBuilderDebug Append(string value)

Parameters

value string

The string to append.

Returns

StringBuilderDebug

The current instance for method chaining.

AppendLine()

Appends a line terminator to the content.

public override StringBuilderDebug AppendLine()

Returns

StringBuilderDebug

The current instance for method chaining.

AppendLine(string)

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

public override StringBuilderDebug AppendLine(string value)

Parameters

value string

The string to append.

Returns

StringBuilderDebug

The current instance for method chaining.

CheckValidity()

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

public void CheckValidity()

CheckValidityWorker(Func<string, bool>?, string?, string)

Worker method that performs content validation and writes invalid content to a file.

public static void CheckValidityWorker(Func<string, bool>? checkValidity, string? invalidJavaScriptFilePath, string content)

Parameters

checkValidity Func<string, bool>

The validation function.

invalidJavaScriptFilePath string

The file path where invalid content will be written.

content string

The content to validate.

Clear()

Clears all content from the builder.

public override StringBuilderDebug Clear()

Returns

StringBuilderDebug

The current instance for method chaining.

ToString()

Returns the current content as a string.

public override string ToString()

Returns

string

The current content.