Class FormattingUtility
public static class FormattingUtility
- Inheritance
-
FormattingUtility
- Inherited Members
Properties
TimeRegex
public static Regex TimeRegex { get; }
Property Value
Methods
ParseTimespan(string)
Parses a timespan string in the form '3d 4hr 21min etc'. Can also be 'perm[anent]'.
public static TimeSpan ParseTimespan(string input)
Parameters
inputstring
Returns
- TimeSpan
Total amount of time. InfiniteTimeSpan is returned if
inputis permanent.
RemoveRichText(string, int, int, RemoveRichTextOptions)
Remove rich text, including TextMeshPro and normal Unity tags.
[Pure]
public static string RemoveRichText(string str, int index = 0, int length = -1, RemoveRichTextOptions options = RemoveRichTextOptions.All)
Parameters
strstringindexintlengthintoptionsRemoveRichTextOptionsTags to check for and remove.
Returns
Exceptions
ReplaceNewLineSubstrings(string?)
Replaces newline constants like '/n', '\n', '<br>', etc with the actual newline character.
public static string? ReplaceNewLineSubstrings(string? str)
Parameters
strstring
Returns
ToArgb(Color)
Convert a UnityEngine.Color to ARGB data.
public static int ToArgb(Color color)
Parameters
colorColor
Returns
ToArgb(Color32)
Convert a UnityEngine.Color32 to ARGB data.
public static int ToArgb(Color32 color)
Parameters
colorColor32
Returns
ToCountdownString(int, bool)
Format a minute/second timer.
public static string ToCountdownString(int seconds, bool withHours)
Parameters
Returns
Remarks
[HH:]MM:SS
ToCountdownString(TimeSpan, bool)
Format a minute/second timer.
public static string ToCountdownString(TimeSpan span, bool withHours)
Parameters
Returns
Remarks
[HH:]MM:SS
ToTimeString(TimeSpan, int, bool)
Converts a timespan to a string in the form '3d 4hr 21min etc'. Will be 'perm[anent]' if timeSpan is InfiniteTimeSpan (or any negative TimeSpan).
public static string ToTimeString(TimeSpan timeSpan, int figures = -1, bool space = false)
Parameters
Returns
TryParseAny(string, IFormatProvider, Type, out object?)
Parse any common type.
public static bool TryParseAny(string input, IFormatProvider provider, Type type, out object? value)
Parameters
inputstringproviderIFormatProvidertypeTypevalueobject