String Extensions
VelocityX gives you powerful extensions for Strings.
Common Operations
First letter uppercase
firstLetterUpperCase()
returns first letter of the string as Caps eg -> Flutter
Remove character
Remove first character
eliminateFirst
removes first element
Remove last character
eliminateLast
removes last element
Empty or null
isEmptyOrNull
returns a bool(true or false) if the string is null or empty
Check if String is Right to Left Language
isRtlLanguage()
returns a bool(true or false)
Returns the string if it is not
null
, or the empty string otherwise >orEmpty
returns a string
orEmpty()
returns a bool(true or false)
if the string is empty perform an action
ifEmpty(action)
returns a string
Capitalize all words inside a string
allWordsCapitilize()
returns a string
Returns a String without white space at all
removeAllWhiteSpace()
returns a string
Returns true if string is neither null, empty nor is solely made of whitespace characters.
isNotBlank
returns a bool
Hide partial values of a string
hidePartial([Optional Params])
returns a bool
Format numeric currency
numCurrency
returns a string
Format numeric currency with provided locale
numCurrencyWithLocale()
returns a string
Validations
Email Validation
validateEmail()
returns a bool(true or false) if the email id is valid or not
Credit/Debit Card Validation
isCreditCardValid()
returns a bool(true or false) if the card is valid or not