MiscExtensionsNullable extension

on

Properties

capitalize String?
Capitalizes the String in normal form.
no setter
charOccurences List<Map<String, int>>
Finds all character occurrences and returns count as:
no setter
containsAnyGreekCharacter bool
Checks whether the supplied string contains any Greek character.
no setter
countWords int
Returns the word count in the given String.
no setter
digitCount int
Returns the digit count of the String.
no setter
formatFileSize String?
Formats the String to show its proper file size.
no setter
greekTimeLiteralToEnglish String
Replaces the Greek 12-hour time literals with the English 12-hour time literals. πμ -> pm -> AM (ante meridiem / before mesembria / before noon) μμ -> mm -> PM (post meridiem / after mesembria / after noon)
no setter
hasSameCharacters bool
Checks if the String is consisted of same characters (ignores cases).
no setter
isAscii bool
Checks whether the String is a valid ASCII string.
no setter
isBlank bool
Checks if the String is Blank (null, empty or only white spaces).
no setter
isCreditCard bool?
Checks if the String provided is a valid credit card number using Luhn Algorithm.
no setter
isDate bool
Checks whether the String is a valid DateTime:
no setter
isGreek bool?
Checks if the String has only Greek characters.
no setter
isGreekId bool
Checks whether the provided String is a valid Greek ID number.
no setter
isGuid bool
Checks whether the String is a valid Guid.
no setter
isIban bool
Checks whether the String is a valid IBAN.
no setter
isIpv4 bool
Checks whether the String is a valid IPv4.
no setter
isIpv6 bool
Checks whether the String is a valid IPv6.
no setter
isLatin bool
Checks if the String has only Latin characters.
no setter
isLowerCase bool?
Checks whether the String is in lowercase.
no setter
isMail bool
Checks whether the String is a valid mail.
no setter
isNotBlank bool
Checks if the String is not blank (null, empty or only white spaces).
no setter
isNotNull bool
Checks whether the String is not null.
no setter
isNull bool
Checks whether the String is null.
no setter
isNumber bool
Checks whether the String is a number.
no setter
isPalindrome bool
Checks whether the String is a palindrome.
no setter
isStrongPassword bool
Checks whether the String complies to below rules :
no setter
isSwiftCode bool?
Checks whether the provided String is a valid Swift code.
no setter
isUpperCase bool?
Checks whether the String is in uppercase.
no setter
isUrl bool
Checks whether the String is a valid URL.
no setter
md5 String?
Returns the MD5 hash of the String.
no setter
onlyGreek String?
Returns only the Greek characters from the String.
no setter
onlyLatin String?
Returns only the Latin characters from the String.
no setter
onlyLetters String?
Returns only the Latin OR Greek characters from the String.
no setter
onlyNumbers String?
Returns only the numbers from the String.
no setter
quote String?
Quotes the String adding "" at the start & at the end.
no setter
removeLetters String?
Removes only the letters from the String.
no setter
removeNumbers String?
Removes only the numbers from the String.
no setter
removeSpecial String?
Returns all special characters from the String.
no setter
removeWhiteSpace String?
Removes all whitespace from the String.
no setter
replaceGreek String?
Replaces all greek characters with latin. Comes handy when you want to normalize text for search.
no setter
reverse String?
Returns the String reversed.
no setter
shuffle String?
Shuffles the given String's characters.
no setter
stripHtml String?
Strips all HTML code from String.
no setter
toArray List<String>
Returns a list of the String's characters.
no setter
toBool bool?
Checks the String and maps the value to a bool if possible.
no setter
toCamelCase String?
Returns the String in camelcase.
no setter
toLeet String?
Transforms the String to 1337 alphabet.
no setter
toSlug String?
Returns the String to slug case.
no setter
toSnakeCase String?
Returns the String to snake_case.
no setter
toTitleCase String?
Returns the String title cased.
no setter
trimAll String?
Trims leading and trailing spaces from the String, so as extra spaces in between words.
no setter

Methods

addAfter(String pattern, String addition) String?
Adds a String after the first match of the pattern. The pattern should not be null.
addBefore(String pattern, String adition) String?
Adds a String before the first match of the pattern. The pattern should not be null.
after(String pattern) String?
Returns the String after a specific character.
append(String suffix) String
Appends a suffix to the String.
asIf(bool comparison(String?), String? trueString, String? falseString) String?
Compares this using comparison and returns trueString if true, otherwise return falseString.
before(String pattern) String?
Returns the String before a specific character
charAt(int index) String?
Returns the character at index of the String.
charCount(String char) int
Finds a specific's character occurrence in the String.
commonCharacters(String otherString, {bool caseSensitive = true, bool sort = true, bool includeSpaces = false}) Set<String>
Returns a Set of the common characters between the two Strings.
containsAll(List<String?> patterns) bool
Checks if the String matches ALL given patterns.
containsAllCharacters(String characters) bool
Checks whether all characters are contained in the String.
containsAny(List<String?> patterns) bool
Checks if the String matches ANY of the given patterns.
defaultValue(String defaultValue) String?
Provide default value if the String is null.
emptyIf(String? comparisonString) String?
Return a empty String if this equals comparisonString. Otherwise return this.
findPattern({required String pattern}) List<int>
Given a pattern returns the starting indices of all occurrences of the pattern in the String.
first({int n = 1}) String?
Returns the first n characters of the String.
firstDayOfMonth({String locale = 'en'}) String?
Returns the first day of the month from the provided DateTime in String format.
formatWithMask(String mask, {String specialChar = '#'}) String?
Inspired from Vincent van Proosdij.
getDayFromDate({String locale = 'en'}) String?
Returns the day name of the date provided in String format.
getJaro(String t) double
The Jaro distance is a measure of edit distance between two strings
getLevenshtein(String b) int?
The Levenshtein distance between two words is the minimum number of single-character
getMonthFromDate({String locale = 'en'}) String?
Returns the month name of the date provided in String format.
getOppositeChar() String?
Returns the opposite wrap char of the String if possible, otherwise returns the same String.
hasWhitespace() bool
Checks whether the String has any whitespace characters.
ifBlank(String? newString) String?
Return this if not blank. Otherwise return newString.
ifEmpty(Function act) String?
If the provided String is empty do something.
ifNull(Function act) String
If the provided String is null do something.
insertAt(int i, String value) String
Inserts a String at the specified index.
isAnagramOf(String s) bool
Checks whether the String is an anagram of the provided String.
isCloseWrapChar() bool
Check if the String is a close wrap char: >, }, ], ", '.
isIn(Iterable<String?> strings) bool
Checks if the String exists in a given Iterable<String>
isJson() bool
Checks if the String is a valid json format.
isLettersOnly() bool
Returns true if the String contains only letters (Latin or Greek).
isMixedCase() bool
Checks whether the String is consisted of both upper and lower case letters.
isOpenWrapChar() bool
Check if String is a open wrap char: <, {, [, ", '.
isUnique() bool
Checks whether the String is consisted of only unique characters.
last({int n = 1}) String?
Returns the last n characters of the String.
lastDayOfMonth({String locale = 'en'}) String?
Returns the last day of the month from the provided DateTime in String format.
leftOf(String char) String?
Returns the left side of the String starting from char.
maxChars(int n) String?
Trims the String to have maximum n characters.
mostFrequent({bool ignoreSpaces = false}) String?
Finds the most frequent character in the String.
nullIf(String? comparisonString) String?
Return null if this equals comparisonString. Otherwise return this.
prepend(String prefix) String
Prepends a prefix to the String.
readTime({int wordsPerMinute = 200}) int
Returns the average read time duration of the given String in seconds.
removeAfter(String pattern) String?
Removes everything in the String after the first match of the pattern.
removeBefore(String pattern) String?
Removes everything in the String before the match of the pattern.
removeFirst(int n) String?
Removes the first n characters from the String.
removeFirstAndLastAny(List<String?> patterns) String?
Continuously removes from the beginning & the end of the String, any match in patterns.
removeFirstAndLastEqual(String? pattern) String?
Removes any pattern match from the beginning & the end of the String.
removeFirstAny(List<String?> patterns) String?
Continuously removes from the beginning of the String any match in patterns.
removeFirstEqual(String? pattern) String?
Removes any pattern match from the beginning of the String.
removeLast(int n) String?
Removes the last n characters from the String.
removeLastAny(List<String?> patterns) String?
Continuously removes from the end of the String, any match in patterns.
removeLastEqual(String? pattern) String?
Removes the pattern from the end of the String.
repeat(int count) String?
Repeats the String count times.
replaceAtIndex({required int index, required String replacement}) String?
Adds a replacement character at index of the String.
replaceFirst(String pattern, String replacement) String
Returns a new String with the first occurrence of the given pattern replaced with the replacement String.
replaceLast(String pattern, String replacement) String
Returns a new String with the last occurrence of the given pattern replaced with the replacement String.
reverseSlash(int direction) String?
Reverses slash in the String, by providing direction,
rightOf(String char) String?
Returns the right side of the String starting from char.
splitLines() List<String>
Splits the String into a List of lines ('\r\n' or '\n').
squeeze(String char) String?
Squeezes the String by removing repeats of a given character.
swapCase() String?
Swaps the case in the String.
toDouble() double?
Converts a String todouble if possible.
toGreekUpperCase() String?
Properly upper cases Greek letters removing their tones.
toInt() int?
Converts a String toint if possible.
toNum() num?
Converts a String to a numeric value if possible.
toPriceAmount({String? currencySymbol}) String?
Tries to format the current String to price amount.
truncate(int length) String?
Truncates the String when more than length characters exist.
truncateMiddle(int maxChars) String?
Truncates a long String in the middle while retaining the beginning and the end.
uncommonCharacters(String otherString, {bool caseSensitive = true, bool includeSpaces = false}) Set<String>
Returns a Set of the uncommon characters between the two Strings.
wrap(String? before, {String? after}) String
Wraps the String between two strings. If before is a wrap char and after is omitted, the method resolve after using getOppositeChar.

Operators

operator -(String? s) String
Removes a text from the String.
operator <(String s) bool
Checks if the length! of the String is less than the length of s.
operator <=(String s) bool
Checks if the length! of the String is less or equal than the length of s.
operator >(String s) bool
Checks if the length! of the String is more than the length of s.
operator >=(String s) bool
Checks if the length! of the String is more or equal than the length of s.