StringExtension extension

on

Methods

capitalize() String
capitalizeAndLowercase() String
Capitalize the first character of the string and lowercase the others (using toUpperCase() and toLowerCase() respectively).
capitalizeAndLowercaseAnyWord() String
Capitalize the first character of any word in the string string and lowercase the others (using toUpperCase() and toLowerCase() respectively). The method also execute am implicit trim() on the atring
capitalizeRestUnchanged() String
Capitalize the first character of the string and leaves the rest as is. In a future release will be called only capitalize
cut(int newLength) String
Cuts the String to the required length starting from the beginning
cutAndAlign(int newLength, {String? paddingChar, bool? leftAlign}) String
Cuts the String and, if lesser then required, aligns it padding the exceeding chars to the right or to the left with the character selected.
getDartIdentifier(int startPosition) String
Extracts the identifier (if present) from a source string in a certain position.
isDartIdentifier(int startPosition) bool
Verifies if the content of one source string in a certain position is a Dart identifier.
onlyContainsAlpha() bool
A convenient way for checking if there are only alpha chars (a-zA-Z).
onlyContainsDigits() bool
A convenient way for checking if there are only digits.
preserveOnlyChars(String validChars, {String? replacementChar}) String
Returns a String that is made of some required chars only. Optionally the removed characters can be substituted with a replacement char
splitInLines(int lineLength, {String? separator, int? firstLineDecrease}) List<String>
Divides a String in lines of the length required. The default separator is blank, but it can be set a different char It is possible to set a different length for the first line.
startsAndEndsWith(String delimiter) bool
Returns true if this string starts and ends with the same given string If whitespaces can be present is better to execute first a trim() call.
trimDelimiters(String delimiter) String
Removes the given delimiters (if present) from the string
trimStringDelimiters() String
Removes String delimiters if present (only the outer ones);
uncapitalizeRestUnchanged() String
Uncapitalize the first character of the string and leaves the rest as is. In a future release will be called only uncapitalize