Strings.takeLast()
Syntax
function takeLast(string: string, count: number): string
Returns the last count characters in the string.
| Parameters | |
string
|
The string to take characters from. |
count
|
The number of characters to take from the end of the string. |
Example
import { Strings } from 'potence';
const string = '987654321';
Strings.takeLast(string, 5); // -> "54321"
Remarks
If string is shorter than count, this function returns the entire string.
If count is negative, this function takes from the beginning of the string instead
(see Strings.take(),
which provides the same functionality).
Contrast Strings.skip().
Compare Strings.takeUntil().