From 070bd29f103842794a78a4bde258c3efb41dd5eb Mon Sep 17 00:00:00 2001 From: "Michael W. Aziz" Date: Fri, 13 Jun 2025 20:46:12 +0300 Subject: [PATCH] [Feat] added String camelcase to title extension. --- lib/src/string_extensions.dart | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/src/string_extensions.dart b/lib/src/string_extensions.dart index c38c424..7f4d63d 100644 --- a/lib/src/string_extensions.dart +++ b/lib/src/string_extensions.dart @@ -17,13 +17,13 @@ extension StringExtensions on String { return (length > 1) ? this[0].toUpperCase() + substring(1) : toUpperCase(); } - /// Convert CamelCase to a capitalized space separated title. + /// Convert CamelCase to a capitalized space separated title. String camelCaseToTitle(String input) { - final spaced = input.replaceAllMapped( + final String spaced = input.replaceAllMapped( RegExp(r'([a-z])([A-Z])'), - (match) => '${match.group(1)} ${match.group(2)}', + (Match match) => '${match.group(1)} ${match.group(2)}', ); - return spaced.split(' ').map((word) => word[0].toUpperCase() + word.substring(1)).join(' '); + return spaced.split(' ').map((String word) => word[0].toUpperCase() + word.substring(1)).join(' '); } }