Skip to content

replace suffix

Subhajit Sahu edited this page May 5, 2020 · 1 revision

Replace suffix match in string with specified value.

const replaceSuffix = require('@extra-string/replace-suffix');
// replaceSuffix(<string>, <suffix>, <replaced value>)

replaceSuffix('tinman', 'man', 'woman');
// 'tinwoman'
replaceSuffix('muscleman', 'cle', 'cled');
// 'muscleman'
replaceSuffix('laughed', 'ed', '');
// 'laugh'

extra-string

Clone this wiki locally