stdlib
stdlib copied to clipboard
[RFC]: Add `@stdlib/string/last`
Description
This RFC proposes adding support for returning the last (visual) character(s) of a string.
Signature:
last( str[, n][options] )
where n specifies the number of visual characters to return. Default: 1.
E.g.,
last( 'foo bar' );
// returns 'r'
last( '🐶🐮🐷🐰🐸', 2 );
// returns '🐰🐸'
Package: @stdlib/string/last
Alias: last
Related Issues
None.
Questions
No.
Other
See @stdlib/string/first for a similar package.
Checklist
- [X] I have read and understood the Code of Conduct.
- [X] Searched for existing issues and pull requests.
- [X] The issue name begins with
RFC:.