MiscExtensions extension

on

Properties

capitalize String?
Capitalizes the string in normal form.
no setter
charOccurences List<Map<String, int>>?
Finds all character ooccurences and returns count as:
no setter
countWords int?
Returns the word count in the given string.
no setter
firstWord String?
input = aditya pratama | output = aditya
no setter
hasSameCharacters bool?
Checks if the string is consisted of same characters (ignores cases).
no setter
iconDocument String
get icon document
no setter
initialName String
input = aditya pratama | output = AP
no setter
isDate bool?
Checks whether the String is valid Date:
no setter
isGreek bool?
Checks if the String has only Greek characters.
no setter
isGuid bool?
Checks whether the String is a valid Guid.
no setter
isIpv4 bool?
Checks whether the String is valid IPv4.
no setter
isIpv6 bool?
Checks whether the String is valid IPv6.
no setter
isLatin bool?
Checks if the String has only Latin characters.
no setter
isMail bool?
Checks whether the String is a valid mail.
no setter
isNull bool
Checks whether the String is null.
no setter
isNumber bool?
Checks whether the String is a number.
no setter
isStrongPassword bool?
Checks whether the String is a "strong" password which complies to below rules :
no setter
isUrl bool?
Checks whether the String is valid URL.
no setter
mostFrequent String?
Finds the most frequent character in 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
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
replaceGreek String?
Replaces all greek words 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 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
toCamelCase String?
Returns the String in camelcase.
no setter
toSlug String?
Returns the string to slug case.
no setter
toTitleCase String?
Returns the word title cased.
no setter
trimAll String?
Trims leading and trailing spaces, so as extra spaces in between words.
no setter
typeDocumentUrl DocumentType
get type document url
no setter

Methods

allAfter(Pattern pattern) String
Searches the string for the first occurrence of a pattern and returns everything after that occurrence.
allBefore(Pattern pattern) String
Searches the string for the last occurrence of a pattern and returns everything before that occurrence.
allBetween(Pattern startPattern, Pattern endPattern) String
Searches the string for the first occurrence of startPattern and the last occurrence of endPattern. It returns the string between that occurrences.
append(String suffix) String?
Appends a suffix to the String.
charAt(int index) String?
Returns the character at index.
charCount(String char) int?
Finds a specific's character occurence in a string.
convertCurrency() String
defaultValue(String defautlValue) String?
Provide default value if the String is null.
findPattern({required String pattern}) List<int>?
Given a pattern returns the starting indices of all occurences 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.
formatWithMask(String mask, {String specialChar = '#'}) String?
Inspired from Vincent van Proosdij Formats a String with a specific mask.
getDayFromDate({String locale = 'en'}) String?
Returns the day name of the date provided.
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.
ifEmpty(Function act) String?
If the provided string is empty do something.
ifNull(Function act) String?
If the provided String is null do something.
isIn(Iterable<String?> strings) bool?
Checks if the String exists in a given Iterable<String>
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.
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.
parseJSON({Object? reviver(Object? key, Object? value)?}) → dynamic
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.
removeFirst(int n) String?
Removes the first n characters of the String.
removeLast(int n) String?
Removes the last n characters of the String.
repeat(int count) String?
Repeats a string count times.
reverseSlash(int direction) String?
Reverses slash by providing direction,
rightOf(String char) String?
Returns the right side of the String starting from char.
squeeze(String char) String?
Squeezes the string by removing repeats of a given character.
toDouble() double?
Converts a string todouble if possible.
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. You can pass
truncate(int length) String?
Truncates a String with more than length characters.
truncateMiddle(int maxChars) String?
Truncates a long String in the middle while retaining the beginning and the end.

Operators

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