StringCustomFunctionExtensions extension
String common function extensions
- on
Properties
- capitalize → String
-
Available on String, provided by the StringCustomFunctionExtensions extension
Capitalizes the first letter of the string. Returns the original string if it is empty.no setter - removeAllSpaces → String
-
Available on String, provided by the StringCustomFunctionExtensions extension
Removes all spaces from the string.no setter - reversed → String
-
Available on String, provided by the StringCustomFunctionExtensions extension
Reverses the string.no setter - toCamelCase → String
-
Available on String, provided by the StringCustomFunctionExtensions extension
Converts the string to camelCase.no setter - toKebabCase → String
-
Available on String, provided by the StringCustomFunctionExtensions extension
Converts the string to kebab-case.no setter - toSnakeCase → String
-
Available on String, provided by the StringCustomFunctionExtensions extension
Converts the string to snake_case.no setter - toTitleCase → String
-
Available on String, provided by the StringCustomFunctionExtensions extension
Converts the string to Title Case.no setter
Methods
-
insert(
int index, String str) → String -
Available on String, provided by the StringCustomFunctionExtensions extension
Inserts the stringstrat the specifiedindexwithin the original string. Throws RangeError ifindexis out of bounds. -
limit(
int count, {String suffix = '...'}) → String -
Available on String, provided by the StringCustomFunctionExtensions extension
Limits the string length tocountand adds optionalsuffix. -
onEmpty(
String? val) → String? -
Available on String, provided by the StringCustomFunctionExtensions extension
Returns a provided alternative stringvalif the original string is empty. Ifvalis null, it defaults to an empty string. -
removePrefix(
String prefix) → String -
Available on String, provided by the StringCustomFunctionExtensions extension
Removes the givenprefixfrom the start of the string if it exists. -
removeSuffix(
String suffix) → String -
Available on String, provided by the StringCustomFunctionExtensions extension
Removes the givensuffixfrom the end of the string if it exists. -
repeat(
int times) → String -
Available on String, provided by the StringCustomFunctionExtensions extension
Repeats the stringtimesnumber of times. -
replaceFirst(
String from, String replace) → String -
Available on String, provided by the StringCustomFunctionExtensions extension
Replaces the first occurrence of the substringfromwithreplace. Iffromis not found in the string, returns the original string. -
replaceLast(
String from, String to) → String -
Available on String, provided by the StringCustomFunctionExtensions extension
Replaces the last occurrence of the substringfromwithto. Iffromis not found in the string, returns the original string. -
safeSubstring(
int startIndex, int endIndex) → String -
Available on String, provided by the StringCustomFunctionExtensions extension
Safely substrings the string, if the string length is not enough, return the original string. -
substringAfter(
String delimiter, {String? missingDelimiterValue}) → String -
Available on String, provided by the StringCustomFunctionExtensions extension
Returns a substring after the first occurrence ofdelimiter. -
substringBefore(
String delimiter, {String? missingDelimiterValue}) → String -
Available on String, provided by the StringCustomFunctionExtensions extension
Returns a substring before the first occurrence ofdelimiter. -
toEnum<
T> (List< T> enumValues) → T? -
Available on String, provided by the StringCustomFunctionExtensions extension
Tries to parse the string into a specified enum typeT. Returns null if the parsing fails. This method requires the list of all enum valuesenumValuesto check against. -
truncate(
int max, {String suffix = '...'}) → String -
Available on String, provided by the StringCustomFunctionExtensions extension
Truncates the string to a maximum ofmaxcharacters and adds asuffixif truncated.