vy_string_utils library
Copyright © 2020 Giorgio Franceschetti. All rights reserved.
Extensions
Functions
-
capitalize(
String string) → String -
capitalizeAndLowercase(
String string) → String - Capitalize the first character of the string and lowercase the others (using toUpperCase() and toLowerCase() respectively).
-
capitalizeAndLowercaseAnyWord(
String string) → 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 string) → String - Capitalize the first character of the string and leaves the rest as is. In a future release will be called only capitalize
-
clearUnrequestedChars(
String string, String validChars, {String? replacementChar}) → String -
cut(
String string, int length) → String - Cuts the String to the required length starting from the beginning
-
cutAndAlign(
String string, 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.
-
dateTimeUpToSeconds(
DateTime time) → String - Simple formatting method for logs (up to seconds)
-
filled(
String? string) → bool - filled() checks if the string contains data;
-
getDartAnnotationIdentifier(
String source, int startPosition) → String - extracts the name of the identifier as described for the isDartAnnotation() method. Same limits as above.
-
getDartIdentifier(
String source, int startPosition) → String - Extracts the identifier (if present) from a source string in a certain position.
-
isDartAnnotation(
String source, int startPosition) → bool - This is a very simple way of checking for an annotation it simply checks for an "@" followed by an identifier It cannot be considered proof safe, but in 99% of cases it should work
-
isDartIdentifier(
String source, int startPosition) → bool - Verifies if the content of one source string in a certain position is a Dart identifier.
-
onlyContainsAlpha(
String string) → bool -
A convenient way for checking if there are only alpha chars (
a-zA-Z
). Also null is accepted (in this case the method returns false...) -
onlyContainsDigits(
String string) → bool - A convenient way for checking if there are only digits. Also null is accepted (in this case the method returns false...)
-
preserveOnlyChars(
String string, 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(
String string, 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 string, 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 string, String delimiter) → String - Removes the given delimiters (if present) from the string
-
trimStringDelimiters(
String string) → String - Removes String delimiters if present (only the outer ones);
-
uncapitalizeRestUnchanged(
String string) → String - Uncapitalize the first character of the string and leaves the rest as is. In a future release will be called only uncapitalize
-
unfilled(
String? string) → bool - unfilled() checks if the string is null or empty;