input string
number of characters to remove (default: 1)
options
updated string
var out = removeLast( 'last man standing', 1, {
'mode': 'code_unit'
});
// returns 'last man standin'
var out = removeLast( '🐶🐮🐷🐰🐸', 2, {
'mode': 'grapheme'
});
// returns '🐶🐮🐷'
Removes the last character of a string.
input string
options
updated string
var out = removeLast( 'last man standing', {
'mode': 'code_unit'
});
// returns 'last man standin'
var out = removeFirst( '🐶🐮🐷🐰🐸', {
'mode': 'grapheme'
});
// returns '🐶🐮🐷🐰'
Removes the last character(s) of a string.
input string
number of characters to remove (default: 1)
updated string
var out = removeLast( 'last man standing' );
// returns 'last man standin'
var out = removeLast( 'presidential election' );
// returns 'presidential electio'
var out = removeLast( 'javaScript' );
// returns 'javaScrip'
var out = removeLast( 'Hidden Treasures' );
// returns 'Hidden Treasure'
var out = removeLast( 'leader', 2 );
// returns 'lead'
Removes the last character(s) of a string.