Skip to content

Latest commit

 

History

History
88 lines (58 loc) · 2.16 KB

File metadata and controls

88 lines (58 loc) · 2.16 KB

LowercaseFormatter

The LowercaseFormatter converts strings to lowercase with proper UTF-8 character support for international text.

Usage

Basic Usage

use Respect\StringFormatter\LowercaseFormatter;

$formatter = new LowercaseFormatter();

echo $formatter->format('HELLO WORLD');
// Outputs: "hello world"

Unicode Characters

use Respect\StringFormatter\LowercaseFormatter;

$formatter = new LowercaseFormatter();

echo $formatter->format('CAFÉ FRANÇAIS');
// Outputs: "café français"

echo $formatter->format('コンニチハ');
// Outputs: "コンニチハ"

Mixed Content

use Respect\StringFormatter\LowercaseFormatter;

$formatter = new LowercaseFormatter();

echo $formatter->format('HELLO WORLD 😊');
// Outputs: "hello world 😊"

API

LowercaseFormatter::__construct

  • __construct()

Creates a new lowercase formatter instance.

format

  • format(string $input): string

Converts the input string to lowercase using UTF-8 aware conversion.

Parameters:

  • $input: The string to convert to lowercase

Returns: The lowercase string

Examples

Input Output Description
HELLO hello Simple ASCII text
CAFÉ café Latin characters with accents
ПРИВЕТ привет Cyrillic text
コンニチハ コンニチハ Japanese text
HELLO 😊 hello 😊 Text with emoji
ÉÎÔÛ éîôû Multiple accented characters

Notes

  • Uses mb_strtolower() for proper Unicode handling
  • Preserves accent marks and diacritical marks
  • Works with all Unicode scripts (Latin, Cyrillic, Greek, CJK, etc.)
  • Emoji and special symbols are preserved unchanged
  • Combining diacritics are properly handled
  • Numbers and special characters remain unchanged
  • Empty strings return empty strings