string_extensions 0.3.3
string_extensions: ^0.3.3 copied to clipboard

Useful String extensions to save you time in production. Feel free to contribute with PR.

[0.3.3] - New Extensions #

  • Removes the first n characters of the String.
removeFirst(int n)
  • Removes the last n characters of the String.
removeLast(int n)
  • Trims the String to have exactly n characters. If n is larger than the String length, the same String is returned.
maxChars(int n)
  • Reverses slash provided the slash direction (int). 0 for / to \ and 1 for \ to /.
reverseSlash(int direction)
  • Returns the character at index.
charAt(int index)
  • Checks if a string is null.
isNull()
  • Do something if a string is null.
ifNull(Function())
  • Provide default value if a string is null.
defaultValue(String defaultValue)
  • Append a String at the end of your String.
append(String suffix)
  • Formats the String to properly show currency amount.
toPriceFormat({String? currencySymbol})

[0.3.2] - Bug Fixes & New Extensions #

Bug fixes & New Extensions #

  • Returns only the Greek characters of the String.
onlyGreek()
  • Checkes whether the String has only Latin characters.
isLatin()
  • Checkes whether the String has only Greek characters.
isGreek()
  • onlyLetters() is now onlyLatin() characters.
  • The countWords extension now correctly counts only words, excluding numbers and symbols from words. For example, Hello 5 2asd friend ! word count will return 3 words.

[0.3.1] - New extensions #

  • Added String? operators >, >=, <, <= to compare String lengths.

  • isIn(Iterable<String>), checks if a given String is in an Iterable<String>.

  • formatWithMask(String mask), formats a String with a specific mask.

[0.3.0] - New extensions & Code improvements #

Successfully converts library to extend String? from String. Further code optimization and bug fixes.

New extensions

  • Converts the String to a num value if possible, else returns null.
toNum()
  • Converts the String to int if possible, else returns null.
toInt()
  • Converts the String to double if possible, else returns null.
toDouble()

[0.2.4] - New extensions #

Improves and renames toStringArray (toArray now)

Adds a new extension that counts specific charater occurences in a String.

charCount(String char)

[0.2.3] - New extensions #

  • Squeezes a String to a character
squeeze(String x);
  • Check if the String is consisted of same characters.
hasSameCharacters();
  • Shuffles the word's letters.
shuffle();
  • Gets the Levenshtein distance of two String
getLevenshtein();
  • Checks if a String is a valid Url.
isUrl();
  • Checks if a String is a valid Date.
isDate();

[0.2.2] - New extensions #

  • Repeats a String x times
repeat(int x);
  • Check if the String is a valid Ipv6
isIpv6();
  • Check if the String is a num
isNumber();
  • An extension that makes easier handling empty strings.
ifEmpty(()=>print('The string is empty'));

[0.2.1] - Downgrade test library version #

Some projects were breaking due to they depending on test_api:3.0.0 version.

[0.2.0] - Adds tests #

[0.1.4] - New extension #

Method to check whether a String is a valid Guid.

isGuid()

[0.1.3] - New extensions #

  • Method to get a List<String> from a String.
toStringArray()
  • Method to strip all HTML code from a String.
stripHtml()
  • Method to check whether a String is a strong password.
isStrongPassword()

[0.1.2] - New extensions & Code refactor #

  • Adds isEmpty checks on all extensions.

  • Given a String and a pattern, finds the starting indices of all occurrences of the pattern in the String.

    findPattern({required String pattern})
    

[0.1.1] - New extensions #

Useful method to normalize greek text for more performant text searches.

replaceGreek()

[0.1.0] - New extensions #

first({int count})
last({int count})
toSlug()

[0.0.3] - New extensions and Null Safety #

News #

Migrates library to null safety.

Extension added :

toTitleCase()

[0.0.2] - New extensions and bug fixes #

Bug fixes #

  • Methods now correctly remove trailing and leading whitespaces from strings.

New extensions #

toCamelCase()
onlyNumbers()
removeLetters()
charOccurences()
mostFrequent()
reverse()
isIpv4()

[0.0.1] - Initial release #

Extension methods #

readTime()
isMail()
capitalize()
removeNumbers()
onlyLetters()
countWords()
12
likes
120
pub points
84%
popularity

Useful String extensions to save you time in production. Feel free to contribute with PR.

Repository (GitHub)
View/report issues

Documentation

API reference

License

BSD-3-Clause (LICENSE)

Dependencies

flutter, intl, test

More

Packages that depend on string_extensions