removeLast

Remove the last character of a string.

Usage

var removeLast = require( '@stdlib/string/remove-last' );

removeLast( str )

Removes the last character of a string.

var out = removeLast( 'last man standing' );
// returns 'last man standin'

out = removeLast( 'Hidden Treasures' );
// returns 'Hidden Treasure';

Examples

var removeLast = require( '@stdlib/string/remove-last' );

var str = removeLast( 'last man standing' );
// returns 'last man standin'

str = removeLast( 'presidential election' );
// returns 'presidential electio'

str = removeLast( 'javaScript' );
// returns 'javaScrip'

str = removeLast( 'Hidden Treasures' );
// returns 'Hidden Treasure';

CLI

Usage

Usage: remove-last [options] [<string>]

Options:

  -h,    --help                Print this message.
  -V,    --version             Print the package version.

Examples

$ remove-last beep
bee

To use as a standard stream,

$ echo -n 'beep' | remove-last
bee