reverseString â
Reverses a string.
typescript
const reversed = reverseString(value);Reference â
reverseString(value) â
Use reverseString when you want to reverse the order of characters in a string. It correctly handles Unicode characters and emojis.
typescript
import { reverseString } from 'es-toolkit/string';
// Basic string reversal
reverseString('hello'); // 'olleh'
reverseString('world'); // 'dlrow'
// Mixed case strings
reverseString('PascalCase'); // 'esaClacsaP'
// Strings with spaces
reverseString('hello world'); // 'dlrow olleh'It accurately handles emojis and special characters.
typescript
import { reverseString } from 'es-toolkit/string';
// Strings with emojis
reverseString('foo đ bar'); // 'rab đ oof'
reverseString('ėë
íė¸ė'); // 'ėė¸íë
ė'
// Numbers and special characters
reverseString('12345'); // '54321'
reverseString('a-b-c'); // 'c-b-a'Parameters â
value(string): The string to reverse.
Returns â
(string): Returns a new string with the characters in reverse order.

