bitbybit.dev v1.0.0-rc.1
    Preparing search index...

    Class TextBitByBit

    Index

    Constructors

    create

    • Creates and returns a text string (pass-through for text input). Example: text='Hello World' → 'Hello World'

      Parameters

      Returns string

      text

      text

      false

    query

    • Checks if text contains a search string. Example: text='hello world', search='world' → true

      Parameters

      Returns boolean

      boolean

      includes

      false

    • Checks if text starts with a search string. Example: text='hello world', search='hello' → true

      Parameters

      Returns boolean

      boolean

      starts with

      false

    • Checks if text ends with a search string. Example: text='hello world', search='world' → true

      Parameters

      Returns boolean

      boolean

      ends with

      false

    • Returns the index of the first occurrence of a search string. Example: text='hello world', search='world' → 6

      Parameters

      Returns number

      index or -1 if not found

      index of

      false

    • Returns the index of the last occurrence of a search string. Example: text='hello world hello', search='hello' → 12

      Parameters

      Returns number

      index or -1 if not found

      last index of

      false

    • Returns the character at the specified index. Example: text='hello', index=1 → 'e'

      Parameters

      Returns string

      character

      char at

      false

    • Returns the length of text. Example: text='hello' → 5

      Parameters

      Returns number

      length

      length

      false

    • Checks if text is empty or only whitespace. Example: text=' ' → true

      Parameters

      Returns boolean

      boolean

      is empty

      false

    regex

    • Tests if text matches a regular expression pattern. Example: text='hello123', pattern='[0-9]+' → true

      Parameters

      Returns boolean

      boolean

      test regex

      false

    • Matches text against a regular expression and returns matches. Example: text='hello123world456', pattern='[0-9]+', flags='g' → ['123', '456']

      Parameters

      Returns string[]

      array of matches or null

      regex match

      false

    • Replaces text matching a regular expression pattern. Example: text='hello123world456', pattern='[0-9]+', flags='g', replaceWith='X' → 'helloXworldX'

      Parameters

      Returns string

      text with replacements

      regex replace

      false

    • Searches text for a regular expression pattern and returns the index. Example: text='hello123', pattern='[0-9]+' → 5

      Parameters

      Returns number

      index or -1 if not found

      regex search

      false

    • Splits text using a regular expression pattern. Example: text='a1b2c3', pattern='[0-9]+' → ['a', 'b', 'c']

      Parameters

      Returns string[]

      array of split strings

      regex split

      false

    transform

    • Splits text into multiple pieces using a separator string. Example: text='apple,banana,cherry', separator=',' → ['apple', 'banana', 'cherry']

      Parameters

      Returns string[]

      text

      split

      false

    • Replaces all occurrences of a search string with a replacement string. Example: text='hello hello', search='hello', replaceWith='hi' → 'hi hi'

      Parameters

      Returns string

      text

      replaceAll

      false

    • Joins multiple items into a single text string using a separator. Example: list=['apple', 'banana', 'cherry'], separator=', ' → 'apple, banana, cherry'

      Parameters

      Returns string

      text

      join

      false

    • Transform any item to text

      Type Parameters

      • T

      Parameters

      Returns string

      text

      to string

      false

    • Transform each item in list to text

      Type Parameters

      • T

      Parameters

      Returns string[]

      texts

      to strings

      false

    • Formats text with placeholder values using {0}, {1}, etc. syntax. Example: text='Point: ({0}, {1})', values=[10, 5] → 'Point: (10, 5)'

      Parameters

      Returns string

      formatted text

      format

      false

    • Extracts a section of text between two indices. Example: text='hello world', start=0, end=5 → 'hello'

      Parameters

      Returns string

      extracted text

      substring

      false

    • Extracts a section of text and returns a new string. Example: text='hello world', start=0, end=5 → 'hello'

      Parameters

      Returns string

      extracted text

      slice

      false

    • Removes whitespace from both ends of text. Example: text=' hello ' → 'hello'

      Parameters

      Returns string

      trimmed text

      trim

      false

    • Removes whitespace from the start of text. Example: text=' hello ' → 'hello '

      Parameters

      Returns string

      trimmed text

      trim start

      false

    • Removes whitespace from the end of text. Example: text=' hello ' → ' hello'

      Parameters

      Returns string

      trimmed text

      trim end

      false

    • Pads text from the start to reach target length. Example: text='x', length=3, padString='a' → 'aax'

      Parameters

      • inputs: TextPadDto

        a text, target length and pad string

      Returns string

      padded text

      pad start

      false

    • Pads text from the end to reach target length. Example: text='x', length=3, padString='a' → 'xaa'

      Parameters

      • inputs: TextPadDto

        a text, target length and pad string

      Returns string

      padded text

      pad end

      false

    • Converts text to uppercase. Example: text='hello' → 'HELLO'

      Parameters

      Returns string

      uppercase text

      to upper case

      false

    • Converts text to lowercase. Example: text='HELLO' → 'hello'

      Parameters

      Returns string

      lowercase text

      to lower case

      false

    • Capitalizes the first character of text. Example: text='hello world' → 'Hello world'

      Parameters

      Returns string

      text with first character uppercase

      capitalize first

      false

    • Lowercases the first character of text. Example: text='Hello World' → 'hello World'

      Parameters

      Returns string

      text with first character lowercase

      uncapitalize first

      false

    • Repeats text a specified number of times. Example: text='ha', count=3 → 'hahaha'

      Parameters

      Returns string

      repeated text

      repeat

      false

    • Reverses the characters in text. Example: text='hello' → 'olleh'

      Parameters

      Returns string

      reversed text

      reverse

      false

    • Concatenates multiple text strings. Example: texts=['hello', ' ', 'world'] → 'hello world'

      Parameters

      Returns string

      concatenated text

      concat

      false

    vector

    • Converts a character to vector paths (polylines) with width and height data for rendering. Uses simplex stroke font to generate 2D line segments representing the character shape. Example: char='A', height=10 → {width:8, height:10, paths:[[points forming A shape]]}

      Parameters

      Returns VectorCharData

      width, height and segments as json

      vector char

      false

    • Converts multi-line text to vector paths (polylines) with alignment and spacing controls. Supports line breaks, letter spacing, line spacing, horizontal alignment, and origin centering. Example: text='Hello\nWorld', height=10, align=center → [{line1 chars}, {line2 chars}]

      Parameters

      Returns VectorTextData[]

      segments

      vector text

      false