Options
All
  • Public
  • Public/Protected
  • All
Menu

External module "string/remove-first/docs/types/index.d"

Index

Functions

Functions

Export assignment removeFirst

  • removeFirst(str: string, n?: undefined | number): string
  • Removes the first character(s) of a string.

    Parameters

    • str: string

      input string

    • Optional n: undefined | number

      number of characters to remove (default: 1)

    Returns string

    updated string

    Example

    var out = removeFirst( 'last man standing' );
    // returns 'ast man standing'

    Example

    var out = removeFirst( 'presidential election' );
    // returns 'residential election'

    Example

    var out = removeFirst( 'javaScript' );
    // returns 'avaScript'

    Example

    var out = removeFirst( 'Hidden Treasures' );
    // returns 'idden Treasures'

    Example

    var out = removeFirst( '🐶🐮🐷🐰🐸', 2 );
    // returns '🐷🐰🐸'

    Example

    var out = removeFirst( 'foo bar', 4 );
    // returns 'bar'