removeTrailingSlashes

removeTrailingSlashes

Removes trailing slashes from a string

Import

import { removeTrailingSlashes } from '@fullstacksjs/toolbox';

Signature

function removeTrailingSlashes(str: string): string {}

Examples

removeTrailingSlashes('')           // ''
removeTrailingSlashes('/')          // ''
removeTrailingSlashes('string')     // 'string'
removeTrailingSlashes('/string')    // 'string'
removeTrailingSlashes('//string')   // 'string'
removeTrailingSlashes('//string/')  // 'string/'
removeTrailingSlashes('//string/a') // 'string/a'