Options
All
  • Public
  • Public/Protected
  • All
Menu

Module startsWith

Index

References

Functions String

References

Renames and re-exports startsWith

String Functions

  • startsWith(string?: string, target: string, position?: number): boolean
  • Checks if string starts with the given target string.

    since

    5.2.0

    see

    endsWith, includes

    example
    startsWith('abc', 'a')
    // => true

    startsWith('abc', 'b')
    // => false

    startsWith('abc', 'b', 1)
    // => true

    Parameters

    • string: string = ""

      The string to inspect.

    • target: string

      The string to search for.

    • position: number = 0

      The position to search from.

    Returns boolean

    Returns true if string starts with target, else false.