MiscExtensions extension

on

Properties

capitalize String?
Capitalizes the string in normal form.
no setter
countWords int?
Returns the word count in the given string.
no setter
firstWord String?
input = aditya pratama | output = aditya
no setter
initialName String
input = aditya pratama | output = AP
no setter
isDate bool?
Checks whether the String is valid Date:
no setter
isIpv4 bool?
Checks whether the String is valid IPv4.
no setter
isIpv6 bool?
Checks whether the String is valid IPv6.
no setter
isMail bool?
Checks whether the String is a valid mail.
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
lastWord String?
input = aditya pratama | output = pratama
no setter
onlyAlfabet String?
Returns only the Latin characters from the String.
no setter
onlyNumbers String?
Returns only the numbers from the String.
no setter
removeLetters String?
Removes only the letters from the String.
no setter
reverse String?
Returns the String reversed.
no setter
stripHtml String?
Strips all HTML code from String.
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

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.
charCount(String char) int?
Finds a specific's character occurence in a string.
first({int n = 1}) String?
Returns the first n characters of the string.
last({int n = 1}) String?
Returns the last n characters of the string.
maxChars(int n) String?
Trims the String to have maximum n characters.
maxLength(int length) String?
maxWords(int maxWords) 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.
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.
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.