From aaa473283f64b78e48f7e8e6f8eeebee67fb018f Mon Sep 17 00:00:00 2001 From: kshib Date: Sun, 10 Mar 2024 18:37:30 +0530 Subject: [PATCH] add createTag and isNumeric methods --- lib/utils/string.dart | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/lib/utils/string.dart b/lib/utils/string.dart index 3f1e173..6e8c52a 100644 --- a/lib/utils/string.dart +++ b/lib/utils/string.dart @@ -4,3 +4,14 @@ String getAsSearchQuery(String category) { } return category; } + + +String createTag(String inputString) { + RegExp specialChars = RegExp(r'[^\w\s]', multiLine: true); + String tag = inputString.replaceAll(specialChars, '').toLowerCase(); + return tag; +} + +bool isNumeric(String str) { + return double.tryParse(str) != null; +}