Provides string manipulation functions for use in HotMesh mapping rules. Although inspired by JavaScript's String API, these methods follow a functional approach where each transformation expects one or more input parameters from the prior row in the @pipe structure.

Methods are invoked with the syntax {@string.<method>}, e.g., {@string.trim} or {@string.toUpperCase}.

Constructors

Methods

  • Retrieves the character at a specified index in a string.

    Parameters

    • input: string

      The string to retrieve the character from.

    • index: number

      The zero-based index of the character.

    Returns string

    The character at the specified index.

    first_letter:
    "@pipe":
    - ["{a.output.data.word}", 0]
    - ["{@string.charAt}"]
  • Concatenates two or more strings into a single string.

    Parameters

    • Rest...strings: string[]

      The strings to concatenate.

    Returns string

    The concatenated result.

    full_name:
    "@pipe":
    - ["{a.output.data.first_name}", " ", "{a.output.data.last_name}"]
    - ["{@string.concat}"]
  • Determines whether a string ends with the characters of a specified string, optionally limiting the check to the first N characters.

    Parameters

    • str: string

      The string to check.

    • searchString: string

      The characters to search for at the end.

    • Optionallength: number

      Optional length of the string to consider.

    Returns boolean

    true if the string ends with the search string, false otherwise.

    ends_with_dot:
    "@pipe":
    - ["{a.output.data.sentence}", "."]
    - ["{@string.endsWith}"]
  • Checks if a string contains a specified substring, optionally starting the search at a given position.

    Parameters

    • input: string

      The string to search within.

    • searchString: string

      The substring to search for.

    • Optionalposition: number

      Optional position to start searching from.

    Returns boolean

    true if the substring is found, false otherwise.

    contains_fox:
    "@pipe":
    - ["{a.output.data.sentence}", "fox"]
    - ["{@string.includes}"]
  • Returns the index of the first occurrence of a specified substring in a string, or -1 if not found.

    Parameters

    • input: string

      The string to search within.

    • searchString: string

      The substring to search for.

    • OptionalfromIndex: number

      Optional index to start searching from.

    Returns number

    The index of the first occurrence, or -1.

    fox_index:
    "@pipe":
    - ["{a.output.data.sentence}", "fox"]
    - ["{@string.indexOf}"]
  • Returns the index of the last occurrence of a specified substring in a string, or -1 if not found.

    Parameters

    • input: string

      The string to search within.

    • searchString: string

      The substring to search for.

    • OptionalfromIndex: number

      Optional index to start searching backward from.

    Returns number

    The index of the last occurrence, or -1.

    last_quick_index:
    "@pipe":
    - ["{a.output.data.sentence}", "quick"]
    - ["{@string.lastIndexOf}"]
  • Pads the end of a string with a given pad string (repeated if needed) until the resulting string reaches the specified maximum length.

    Parameters

    • input: string

      The string to pad.

    • maxLength: number

      The target length of the resulting string.

    • OptionalpadString: string

      The string to pad with (defaults to spaces).

    Returns string

    The padded string.

    padded:
    "@pipe":
    - ["{a.output.data.value}", 10, "."]
    - ["{@string.padEnd}"]
  • Pads the start of a string with a given pad string (repeated if needed) until the resulting string reaches the specified maximum length.

    Parameters

    • input: string

      The string to pad.

    • maxLength: number

      The target length of the resulting string.

    • OptionalpadString: string

      The string to pad with (defaults to spaces).

    Returns string

    The padded string.

    padded:
    "@pipe":
    - ["{a.output.data.value}", 5, "0"]
    - ["{@string.padStart}"]
  • Creates a new string by repeating the given string a specified number of times. The count must be a non-negative finite number.

    Parameters

    • str: string

      The string to repeat.

    • count: number

      The number of times to repeat (must be >= 0 and finite).

    Returns string

    The repeated string.

    repeated_text:
    "@pipe":
    - ["{a.output.data.text}", 3]
    - ["{@string.repeat}"]
  • Replaces the first occurrence of a search value (string or RegExp) in a string with a replacement string.

    Parameters

    • input: string

      The string to search within.

    • searchValue: string | RegExp

      The value to search for.

    • replaceValue: string

      The replacement string.

    Returns string

    The string with the first match replaced.

    replaced:
    "@pipe":
    - ["{a.output.data.text}", "old", "new"]
    - ["{@string.replace}"]
  • Searches a string for a match against a regular expression and returns the index of the first match, or -1 if no match is found.

    Parameters

    • input: string

      The string to search within.

    • regexp: RegExp

      The regular expression to search for.

    Returns number

    The index of the first match, or -1.

    match_index:
    "@pipe":
    - ["{a.output.data.text}", "/\\d+/"]
    - ["{@string.search}"]
  • Extracts a section of a string and returns it as a new string, without modifying the original.

    Parameters

    • input: string

      The string to extract from.

    • Optionalstart: number

      The zero-based start index (inclusive).

    • Optionalend: number

      The zero-based end index (exclusive).

    Returns string

    The extracted substring.

    substring:
    "@pipe":
    - ["{a.output.data.sentence}", 4, 9]
    - ["{@string.slice}"]
  • Splits a string into an array of substrings based on a specified delimiter.

    Parameters

    • input: string

      The string to split.

    • delimiter: string

      The delimiter to split on.

    Returns string[]

    An array of substrings.

    words:
    "@pipe":
    - ["{a.output.data.sentence}", " "]
    - ["{@string.split}"]
  • Determines whether a string begins with the characters of a specified string, optionally starting the check at a given position.

    Parameters

    • str: string

      The string to check.

    • searchString: string

      The characters to search for at the start.

    • Optionalposition: number

      Optional position to begin searching from.

    Returns boolean

    true if the string starts with the search string, false otherwise.

    starts_with_the:
    "@pipe":
    - ["{a.output.data.sentence}", "The"]
    - ["{@string.startsWith}"]
  • Returns a portion of a string between the specified start and end indices. Unlike slice, negative indices are treated as 0 and arguments are swapped if start is greater than end.

    Parameters

    • input: string

      The string to extract from.

    • start: number

      The start index (inclusive).

    • Optionalend: number

      The end index (exclusive).

    Returns string

    The extracted substring.

    substring:
    "@pipe":
    - ["{a.output.data.sentence}", 4, 9]
    - ["{@string.substring}"]
  • Converts all characters in a string to lowercase.

    Parameters

    • input: string

      The string to convert.

    Returns string

    The lowercase string.

    lowercase_sentence:
    "@pipe":
    - ["{a.output.data.sentence}"]
    - ["{@string.toLowerCase}"]
  • Converts all characters in a string to uppercase.

    Parameters

    • input: string

      The string to convert.

    Returns string

    The uppercase string.

    uppercase_sentence:
    "@pipe":
    - ["{a.output.data.sentence}"]
    - ["{@string.toUpperCase}"]
  • Removes whitespace from both ends of a string.

    Parameters

    • input: string

      The string to trim.

    Returns string

    The trimmed string.

    trimmed_text:
    "@pipe":
    - ["{a.output.data.text}"]
    - ["{@string.trim}"]
  • Removes whitespace from the end of a string.

    Parameters

    • input: string

      The string to trim.

    Returns string

    The string with trailing whitespace removed.

    trimmed_end_text:
    "@pipe":
    - ["{a.output.data.text}"]
    - ["{@string.trimEnd}"]
  • Removes whitespace from the beginning of a string.

    Parameters

    • input: string

      The string to trim.

    Returns string

    The string with leading whitespace removed.

    trimmed_start_text:
    "@pipe":
    - ["{a.output.data.text}"]
    - ["{@string.trimStart}"]