utility-pickle - v0.1.0
    Preparing search index...

    Class StringTransformation

    A static utility class for common and advanced string transformation and manipulation tasks.

    Index

    Methods

    • Capitalizes the first character of the string.

      Parameters

      • s: string

        The string to capitalize.

      Returns string

      The string with its first character in uppercase.

    • Returns the Unicode code point of the first character of the string.

      Parameters

      • s: string

        The input string.

      Returns number

      The character code of the first character.

    • Counts the number of times a substring occurs in a string.

      Parameters

      • s: string

        The input string.

      • subStr: string

        The substring to count.

      Returns number

      The count of occurrences.

    • Returns the leftmost n characters of a string.

      Parameters

      • s: string

        The input string.

      • n: number

        The number of characters.

      Returns string

      The substring containing the first n characters.

    • Pads the left side of a string with a given character up to the specified length.

      Parameters

      • s: string

        The input string.

      • length: number

        The desired total length.

      • char: string = " "

        The padding character (default: space).

      Returns string

      The padded string.

    • Pads the right side of a string with a given character up to the specified length.

      Parameters

      • s: string

        The input string.

      • length: number

        The desired total length.

      • char: string = " "

        The padding character (default: space).

      Returns string

      The padded string.

    • Removes all instances of a substring from a string.

      Parameters

      • s: string

        The input string.

      • subStr: string

        The substring to remove.

      Returns string

      The string with all instances of subStr removed.

    • Removes all digit characters from a string.

      Parameters

      • s: string

        The input string.

      Returns string

      The string with digits removed.

    • Removes all letter characters from a string.

      Parameters

      • s: string

        The input string.

      Returns string

      The string with letters removed.

    • Removes all non-alphanumeric characters from a string.

      Parameters

      • s: string

        The input string.

      Returns string

      The string with non-alphanumeric characters removed.

    • Removes all whitespace characters from a string.

      Parameters

      • s: string

        The string to process.

      Returns string

      The string without any whitespace.

    • Repeats the input string a specified number of times.

      Parameters

      • s: string

        The string to repeat.

      • count: number

        The number of times to repeat.

      Returns string

      The concatenated result string.

    • Returns the rightmost n characters of a string.

      Parameters

      • s: string

        The input string.

      • n: number

        The number of characters.

      Returns string

      The substring containing the last n characters.

    • Splits a string by a delimiter or regular expression.

      Parameters

      • s: string

        The string to split.

      • delimiter: string | RegExp

        The delimiter string or RegExp.

      • Optionallimit: number

        Optional maximum number of splits.

      Returns string[]

      An array of split substrings.

    • Converts a string or number to an integer (using base 10).

      Parameters

      • i: string | number

        The string or number to convert.

      Returns number

      The integer value.

    • Converts all characters in a string to lowercase.

      Parameters

      • s: string

        The string to convert.

      Returns string

      The lowercase version of the input string.

    • Converts a string to a floating-point number, returning a fallback if conversion fails.

      Parameters

      • i: string

        The string to convert.

      • fallback: number = 0

        The fallback value if conversion fails (default: 0).

      Returns number

      The converted number or the fallback.

    • Converts all characters in a string to uppercase.

      Parameters

      • s: string

        The string to convert.

      Returns string

      The uppercase version of the input string.

    • Truncates a string to a maximum length.

      Parameters

      • s: string

        The input string.

      • maxLength: number

        The maximum allowed length.

      Returns string

      The truncated string, or the original if shorter than maxLength.