removeAt

Removes the character at the specified index in the input string.

Usage Scenarios

  • Text Correction: In text editing, remove a typo or unwanted character.
  • Data Manipulation: Modify a string by removing a specific character.

Example

import { removeAt } from 'funtool/string'

removeAt('hello', 1) // ✅ 'hllo'
removeAt('abc-def', '-') // ✅ 'abcdef'

Signature

function removeAt(input: string, target: string | number): string

Parameters

  • input ( string ): The input string.
  • target ( string | number ): The index of the character to remove.

Returns

  • ( string ): A new string with the character at the specified index removed.