stdlib icon indicating copy to clipboard operation
stdlib copied to clipboard

[RFC]: Add `@stdlib/string/last`

Open kgryte opened this issue 2 years ago • 0 comments

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:.

kgryte avatar Feb 07 '23 23:02 kgryte