toUpperAt

Converts the character at the specified index in the input string to uppercase.

Usage Scenarios

  • Text Correction: In text editing, correct the case of a specific character.
  • Data Normalization: Standardize the case of characters in a string.

Example

import { toUpperAt } from 'funtool/string'

toUpperAt('hello', 0) // ✅ 'Hello'
toUpperAt('foo-bar', 'b') // ✅ 'foo-Bar'

Signature

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

Parameters

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

Returns

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