Tlumach
  • Articles
  • API Reference
Search Results for

    Show / Hide Table of Contents
    • Tlumach
      • Base
        • ArbParser
        • ArbPlaceholder
        • BaseGenerator
        • BaseJsonParser
        • BaseKeyValueParser
        • BaseParser
        • BaseTableParser
        • BaseXMLParser
        • CsvParser
        • CultureNameMatchEventArgs
        • FileFormats
        • GenericParserException
        • IniParser
        • JsonParser
        • ParserConfigException
        • ParserFileException
        • ParserLoadException
        • Placeholder
        • ResxParser
        • TemplateParserException
        • TemplateProcessingException
        • TextFileParseException
        • TextFormat
        • TextParseException
        • TlumachException
        • TomlParser
        • Translation
        • TranslationConfiguration
        • TranslationEntry
        • TranslationTree
        • TranslationTreeLeaf
        • TranslationTreeNode
        • TsvParser
        • Utils
      • BaseTranslationUnit
      • CultureChangedEventArgs
      • FileContentNeededEventArgs
      • TemplatedTranslationUnit
      • TranslationManager
      • TranslationUnit
      • TranslationValueEventArgs

    Class Utils

    Contains helper functions, usable across the library.

    Inheritance
    object
    Utils
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: Tlumach.Base
    Assembly: Tlumach.Base.dll
    Syntax
    public static class Utils

    Fields

    C_BACKSLASH

    Declaration
    public const char C_BACKSLASH = '\\'
    Field Value
    Type Description
    char

    C_DOUBLE_QUOTE

    Declaration
    public const char C_DOUBLE_QUOTE = '"'
    Field Value
    Type Description
    char

    C_SINGLE_QUOTE

    Declaration
    public const char C_SINGLE_QUOTE = '\''
    Field Value
    Type Description
    char

    KEY_DECIMAL_DIGITS

    Declaration
    public const string KEY_DECIMAL_DIGITS = "decimalDigits"
    Field Value
    Type Description
    string

    KEY_LOCALE

    Declaration
    public const string KEY_LOCALE = "locale"
    Field Value
    Type Description
    string

    KEY_NAME

    Declaration
    public const string KEY_NAME = "name"
    Field Value
    Type Description
    string

    KEY_SYMBOL

    Declaration
    public const string KEY_SYMBOL = "symbol"
    Field Value
    Type Description
    string

    S_BACKSLASH

    Declaration
    public const string S_BACKSLASH = "\\"
    Field Value
    Type Description
    string

    S_DOUBLE_QUOTE

    Declaration
    public const string S_DOUBLE_QUOTE = "\""
    Field Value
    Type Description
    string

    S_SINGLE_QUOTE

    Declaration
    public const string S_SINGLE_QUOTE = "'"
    Field Value
    Type Description
    string

    Methods

    ConvertToDouble(object)

    Declaration
    public static double ConvertToDouble(object a)
    Parameters
    Type Name Description
    object a
    Returns
    Type Description
    double

    ConvertToLong(object)

    Declaration
    public static long ConvertToLong(object a)
    Parameters
    Type Name Description
    object a
    Returns
    Type Description
    long

    FormatArbDateTime(object, Placeholder, CultureInfo)

    Declaration
    public static string FormatArbDateTime(object value, Placeholder placeholder, CultureInfo culture)
    Parameters
    Type Name Description
    object value
    Placeholder placeholder
    CultureInfo culture
    Returns
    Type Description
    string

    FormatArbNumber(object, Func<string, int, object?>, Placeholder, string, CultureInfo)

    Declaration
    public static string FormatArbNumber(object value, Func<string, int, object?> getParamValueFunc, Placeholder placeholder, string placeholderContentTail, CultureInfo culture)
    Parameters
    Type Name Description
    object value
    Func<string, int, object> getParamValueFunc
    Placeholder placeholder
    string placeholderContentTail
    CultureInfo culture
    Returns
    Type Description
    string

    FormatArbString(object, Func<string, int, object?>, string, CultureInfo)

    Declaration
    public static string FormatArbString(object value, Func<string, int, object?> getParamValueFunc, string placeholderContentTail, CultureInfo culture)
    Parameters
    Type Name Description
    object value
    Func<string, int, object> getParamValueFunc
    string placeholderContentTail
    CultureInfo culture
    Returns
    Type Description
    string

    FormatArbUnknownPlaceholder(object, Func<string, int, object?>, string, CultureInfo)

    Declaration
    public static string FormatArbUnknownPlaceholder(object value, Func<string, int, object?> getParamValueFunc, string placeholderContentTail, CultureInfo culture)
    Parameters
    Type Name Description
    object value
    Func<string, int, object> getParamValueFunc
    string placeholderContentTail
    CultureInfo culture
    Returns
    Type Description
    string

    GetLeadingNonNegativeNumber(string, out int)

    Extracts the number from a string when the string starts with a positive decimal number.

    Declaration
    public static int GetLeadingNonNegativeNumber(string text, out int charsUsed)
    Parameters
    Type Name Description
    string text

    The text to extract the number from.

    int charsUsed

    The number of characters used from text to parse as a number.

    Returns
    Type Description
    int

    The extracted number or -1 in the case when a number was not extracted.

    IsBoxedIntegerNumber(object?)

    Checks if the argument is of a integer type.

    Declaration
    public static bool IsBoxedIntegerNumber(object? obj)
    Parameters
    Type Name Description
    object obj

    An object to check.

    Returns
    Type Description
    bool

    true if obj is a number and false otherwise.

    IsBoxedNumber(object?)

    Checks if the argument is of a numeric type.

    Declaration
    public static bool IsBoxedNumber(object? obj)
    Parameters
    Type Name Description
    object obj

    An object to check.

    Returns
    Type Description
    bool

    true if obj is a number and false otherwise.

    IsIdentifier(string?)

    Declaration
    public static bool IsIdentifier(string? value)
    Parameters
    Type Name Description
    string value
    Returns
    Type Description
    bool

    IsIdentifierWithDots(string?)

    Declaration
    public static bool IsIdentifierWithDots(string? value)
    Parameters
    Type Name Description
    string value
    Returns
    Type Description
    bool

    ParseDate(string, string)

    Declaration
    public static DateTime ParseDate(string date, string format)
    Parameters
    Type Name Description
    string date
    string format
    Returns
    Type Description
    DateTime

    ParseDateISO8601(string?)

    Declaration
    public static DateTime? ParseDateISO8601(string? date)
    Parameters
    Type Name Description
    string date
    Returns
    Type Description
    DateTime?

    ReadFileFromDisk(string)

    Declaration
    public static string? ReadFileFromDisk(string filename)
    Parameters
    Type Name Description
    string filename
    Returns
    Type Description
    string

    ReadFileFromDisk(string, string?, string?)

    Declaration
    public static string? ReadFileFromDisk(string filename, string? baseDirectory, string? baseDirectory2)
    Parameters
    Type Name Description
    string filename
    string baseDirectory
    string baseDirectory2
    Returns
    Type Description
    string

    ReadFileFromResource(Assembly, string)

    Declaration
    public static string? ReadFileFromResource(Assembly assembly, string filename)
    Parameters
    Type Name Description
    Assembly assembly
    string filename
    Returns
    Type Description
    string

    ReadFileFromResource(Assembly, string, string?, string?)

    Declaration
    public static string? ReadFileFromResource(Assembly assembly, string filename, string? baseDirectory, string? baseDirectory2)
    Parameters
    Type Name Description
    Assembly assembly
    string filename
    string baseDirectory
    string baseDirectory2
    Returns
    Type Description
    string

    TryGetPropertyValue(object, string, out object?)

    Declaration
    public static bool TryGetPropertyValue(object obj, string propertyName, out object? value)
    Parameters
    Type Name Description
    object obj
    string propertyName
    object value
    Returns
    Type Description
    bool

    UnescapeString(string)

    Decodes escaping used in JSON and TOML strings.

    Declaration
    public static string UnescapeString(string value)
    Parameters
    Type Name Description
    string value

    original string to decode.

    Returns
    Type Description
    string

    a decoded string.

    In this article
    Back to top Generated by DocFX