extract-last-number

Extract last number from given string. return array with the string without the number, and the number himself

Usage no npm install needed!

<script type="module">
  import extractLastNumber from 'https://cdn.skypack.dev/extract-last-number';
</script>

README

extractLastNumber

Extract last number from given string. return array with the string without the number, and the number himself

Usage: extractLastNumber(str: string): [string, number]

import { extractLastNumber } from 'extract-last-number'

extractLastNumber('name1')
// Output: ["name", 1]
extractLastNumber('name')
// Output: ["name", null]
extractLastNumber('name01')
// Output: ["name0", 1]

This module exported from utilizes project.