mirror of
https://github.com/hanskokx/arcane_helper_utils.git
synced 2026-05-14 02:19:09 +02:00
v1.2.4
- Made `String` manipulation utilities available for nullable objects Signed-off-by: Hans Kokx <hans.kokx@hackberry.se>
This commit is contained in:
@@ -1,3 +1,7 @@
|
|||||||
|
## 1.2.4
|
||||||
|
|
||||||
|
- Made `String` manipulation utilities available for nullable objects
|
||||||
|
|
||||||
## 1.2.3
|
## 1.2.3
|
||||||
|
|
||||||
- Adjusted `capitalize` extension to convert remaining letters to lowercase
|
- Adjusted `capitalize` extension to convert remaining letters to lowercase
|
||||||
|
|||||||
@@ -2,8 +2,7 @@ library arcane_helper_utils;
|
|||||||
|
|
||||||
export "package:arcane_helper_utils/src/extensions/date_time.dart";
|
export "package:arcane_helper_utils/src/extensions/date_time.dart";
|
||||||
export "package:arcane_helper_utils/src/extensions/list.dart";
|
export "package:arcane_helper_utils/src/extensions/list.dart";
|
||||||
export "package:arcane_helper_utils/src/extensions/string.dart"
|
export "package:arcane_helper_utils/src/extensions/string.dart";
|
||||||
show Nullability, Split, TextManipulation, CommonString;
|
|
||||||
export "package:arcane_helper_utils/src/extensions/string_jwt.dart";
|
export "package:arcane_helper_utils/src/extensions/string_jwt.dart";
|
||||||
export "package:arcane_helper_utils/src/utils/json_converter.dart";
|
export "package:arcane_helper_utils/src/utils/json_converter.dart";
|
||||||
export "package:arcane_helper_utils/src/utils/ticker.dart";
|
export "package:arcane_helper_utils/src/utils/ticker.dart";
|
||||||
|
|||||||
@@ -76,7 +76,7 @@ extension Split on String {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// An extension on `String` to perform text manipulation tasks.
|
/// An extension on `String` to perform text manipulation tasks.
|
||||||
extension TextManipulation on String {
|
extension TextManipulation on String? {
|
||||||
/// Capitalizes the first letter of the string.
|
/// Capitalizes the first letter of the string.
|
||||||
///
|
///
|
||||||
/// This method returns a new string where the first character is converted
|
/// This method returns a new string where the first character is converted
|
||||||
@@ -88,8 +88,8 @@ extension TextManipulation on String {
|
|||||||
/// String capitalized = text.capitalize; // "Hello"
|
/// String capitalized = text.capitalize; // "Hello"
|
||||||
/// ```
|
/// ```
|
||||||
String get capitalize {
|
String get capitalize {
|
||||||
if (isEmpty) return "";
|
if (isNullOrEmpty) return "";
|
||||||
return "${this[0].toUpperCase()}${substring(1).toLowerCase()}";
|
return "${this![0].toUpperCase()}${this!.substring(1).toLowerCase()}";
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Capitalizes the first letter of each word in the string.
|
/// Capitalizes the first letter of each word in the string.
|
||||||
@@ -103,7 +103,8 @@ extension TextManipulation on String {
|
|||||||
/// String capitalizedWords = text.capitalizeWords; // "Hello World"
|
/// String capitalizedWords = text.capitalizeWords; // "Hello World"
|
||||||
/// ```
|
/// ```
|
||||||
String get capitalizeWords {
|
String get capitalizeWords {
|
||||||
final strings = split(" ");
|
if (isNullOrEmpty) return "";
|
||||||
|
final strings = this!.split(" ");
|
||||||
return strings.map((s) => s.capitalize).join(" ");
|
return strings.map((s) => s.capitalize).join(" ");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -120,7 +121,8 @@ extension TextManipulation on String {
|
|||||||
/// String spaced = text.spacePascalCase; // "Arcane Helper Utils"
|
/// String spaced = text.spacePascalCase; // "Arcane Helper Utils"
|
||||||
/// ```
|
/// ```
|
||||||
String get spacePascalCase {
|
String get spacePascalCase {
|
||||||
final List<String> strings = split(
|
if (isNullOrEmpty) return "";
|
||||||
|
final List<String> strings = this!.split(
|
||||||
"",
|
"",
|
||||||
);
|
);
|
||||||
String output = "";
|
String output = "";
|
||||||
|
|||||||
+1
-1
@@ -1,7 +1,7 @@
|
|||||||
name: arcane_helper_utils
|
name: arcane_helper_utils
|
||||||
description: Provides a variety of helpful utilities and extensions for Flutter
|
description: Provides a variety of helpful utilities and extensions for Flutter
|
||||||
and Dart.
|
and Dart.
|
||||||
version: 1.2.3
|
version: 1.2.4
|
||||||
repository: https://github.com/hanskokx/arcane_helper_utils
|
repository: https://github.com/hanskokx/arcane_helper_utils
|
||||||
issue_tracker: https://github.com/hanskokx/arcane_helper_utils/issues
|
issue_tracker: https://github.com/hanskokx/arcane_helper_utils/issues
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user