Skip to main content
The Deno 2 Release Candidate is here
Learn more
Module

x/rimbu/typical/str.ts>Last

Rimbu is a TypeScript library focused on immutable, performant, and type-safe collections and other tools.
Go to Latest
type alias Last
import { type Last } from "https://deno.land/x/rimbu@1.0.2/typical/str.ts";

Returns the last character of the given string, or false if the string if empty.

Examples

Example 1

Last<'abcd'> => 'd'
Last<''> => false

Type Parameters

S extends string
definition: S extends Append<infer First, infer Rest> ? U.Extends<Rest, "", First, Last<Rest>> : false