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

x/ayonli_jsext/esm/string/index.js>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/esm/string/index.js";

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
suffix