Skip to content

Latest commit

 

History

History
62 lines (40 loc) · 1019 Bytes

swapcase.md

File metadata and controls

62 lines (40 loc) · 1019 Bytes

swapcase

Invert the case of every letter in a string.

API

Numeric.string.swapcase(text)

Inverts uppercase and lowercase letters.

  • Parameters:
    • text: String or array of strings to convert
  • Returns: Case-swapped strings matching the input shape
  • NumPy: Covers np.strings.swapcase, np.char.swapcase through a single Numerix method.

Examples

Swap the case of a string

import Numeric from '@neabyte/numerix'

const value = Numeric.string.swapcase('HeLLo')

console.log(value)
// hEllO

Swap the case of an array

import Numeric from '@neabyte/numerix'

const values = Numeric.string.swapcase(['Ab', 'Cd'])

console.log(values)
// ["aB","cD"]

Swap the case of a lowercase string

import Numeric from '@neabyte/numerix'

const value = Numeric.string.swapcase('abc')

console.log(value)
// ABC

Swap the case of digits

import Numeric from '@neabyte/numerix'

const value = Numeric.string.swapcase('123')

console.log(value)
// 123