Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/ayonli_jsext/string/index.ts>stripEnd

A JavaScript extension package for building strong and modern applications.
Latest
function stripEnd
import { stripEnd } from "https://deno.land/x/ayonli_jsext@v0.9.72/string/index.ts";

Removes the given suffix of the string if present.

Examples

Example 1

import { stripEnd } from "@ayonli/jsext/string";

console.log(stripEnd("hello world", "world")); // "hello "
console.log(stripEnd("hello world", "hello")); // "hello world"

Parameters

str: string
suffix: string

Returns

string