Table of Contents

Class StringUtility

Namespace
FishMMO.Shared.NameGeneration
Assembly
FishMMO.Shared.dll

Shared string-sanitization helpers used by the name generator and its editor tooling.

public static class StringUtility
Inheritance
StringUtility
Inherited Members

Methods

SanitizeFileName(string, string)

Asset-filename-safe sanitizer: keeps letters, digits, underscore, and hyphen; lowercases the rest. Non-matching characters become underscore. Empty input returns fallback.

public static string SanitizeFileName(string s, string fallback = "unnamed")

Parameters

s string
fallback string

Returns

string

Slug(string, string)

URL / id slug: lowercase letters and digits, non-alphanumerics collapsed to a single -. Empty input returns fallback. Also strips template metacharacters ({, }) so a malicious or mis-named source file cannot inject a lore slot.

public static string Slug(string s, string fallback = "unknown")

Parameters

s string
fallback string

Returns

string

StripTemplateChars(string)

Strips template metacharacters { and } from a string. Use when a value flows into a template expansion path to prevent injection of unresolved slot tokens.

public static string StripTemplateChars(string s)

Parameters

s string

Returns

string