Extract a substring from a string.
Numeric.string.slice(text, start = 0, stop)Slices each string between the given bounds.
- Parameters:
text: String or array of strings to slicestart: Starting index of the extracted portionstop: Ending index of the extracted portion
- Returns: Extracted substrings matching the input shape
- NumPy: Covers
np.strings.slice,np.char.slicethrough a single Numerix method.
import Numeric from '@neabyte/numerix'
const value = Numeric.string.slice('hello', 1, 3)
console.log(value)
// elimport Numeric from '@neabyte/numerix'
const value = Numeric.string.slice('hello', 0, 2)
console.log(value)
// heimport Numeric from '@neabyte/numerix'
const value = Numeric.string.slice('hello', 3)
console.log(value)
// loimport Numeric from '@neabyte/numerix'
const values = Numeric.string.slice(['hello', 'world'], 0, 2)
console.log(values)
// ["he","wo"]