Skip to Main Content

BTD_Mod_Helper​.Extensions​.StringExt


BloonsTD6 Mod Helper

BTD_Mod_Helper.Extensions

StringExt Class

Extensions for strings

public static class StringExt

Inheritance System.Object  StringExt

Methods

StringExt.GetBtd6Localization(this string, bool) Method

Gets the localization from the current localization text table, or the default one if it's not present in the current one.
If the id is not present in any of these, returned as spaced or not spaced depending on parameters.

public static string GetBtd6Localization(this string id, bool returnAsSpacedIfNoEntry=true);

Parameters

id System.String

The ID of the thing you're trying to get the localization of.

returnAsSpacedIfNoEntry System.Boolean

Should this return the id with spaces if there's no localization present?

Returns

System.String

StringExt.Localize(this string) Method

Gets the localization from the current localization text table, or the default one if it's not present in the current one.
If the id is not present in any of these, returned as spaced or not spaced depending on parameters.

public static string Localize(this string id);

Parameters

id System.String

The ID of the thing you're trying to get the localization of.

Returns

System.String

StringExt.NullIfEmpty(this string) Method

Returns null if a string is empty / whitespace, otherwise just returns back the string

public static string NullIfEmpty(this string s);

Parameters

s System.String

Returns

System.String

StringExt.RegexReplace(this string, string, string) Method

public static string RegexReplace(this string input, string pattern, string replacement);

Parameters

input System.String

pattern System.String

replacement System.String

Returns

System.String

StringExt.Spaced(this string) Method

Puts spaces between capitalized words within a string

public static string Spaced(this string s);

Parameters

s System.String

Returns

System.String

StringExt.SplitRespectingQuotes(this string) Method

Splits the string on spaces, but preserves strings of words with spaces if surround by quotes

public static string[] SplitRespectingQuotes(this string input);

Parameters

input System.String

Returns

System.String[]

StringExt.ToTitleCase(this string) Method

public static string ToTitleCase(this string input);

Parameters

input System.String

Returns

System.String

To learn how to download BTD Mod Helper and install mods, click here