string_extensions

asd

Useful String extensions to save you time in production.

Getting Started

Current String extensions :

  • readTime()
String foo =  'Hello dear friend how you doing ?';
int readTime = foo.readTime() // returns 3 seconds.
  • isMail()
String foo = 'esentis@esentis.com'
bool isMail = foo.isMail() // returns true
String foo = 'esentis@esentis'
bool isMail = foo.isMail() // returns false
  • onyLetters()
String foo = '4*%^55/es4e5523nt1is';
String letters = foo.onlyLetters() // returns 'esentis';
  • removeNumbers()
String foo = 'es4e5523nt1is';
String noNums = foo.removeNumbers() // returns 'esentis'
String foo = '1244e*s*4e*5523n*t*1i*s'
String noNums = foo.removeNumbers() // returns 'e*s*e*n*t*i*s'
  • countWords()
String foo = 'Hello dear friend how you doing ?';
int count = foo.countWords() // returns 7 words.
  • capitalize()
String foo = 'hAckErrR';
String cFoo = foo.capitalize(); // returns 'Hackerrr'.
  • toCamelCase()
String foo = 'Find max of array';
String camelCase = foo.toCamelCase() // returns 'findMaxOfArray'
  • onlyNumbers()
String foo = '4*%^55/es4e5523nt1is';
String onyNumbers = foo.onlyNumbers() // returns '455455231'
  • removeLetters()
String foo = 'es4e5523nt1is';
String noLetters = foo.removeLetters() // returns '455231'
String foo = '1244e*s*4e*5523n*t*1i*s'
String noLetters = foo.removeLetters() // returns '1244**4*5523**1*'
  • charOccurences()
String foo = 'esentis';
List occurences = foo.charOccurences() // returns '[{e:2},{i:1},{n:1},{s:2},]'
  • mostFrequent()
String foo = 'Hello World';
String mostFrequent = foo.mostFrequent() // returns 'l'
  • reverse()
String foo = 'Hello World';
String reversed = foo.reverse() ; // returns 'dlrow olleH'
  • isIpv4()
String foo = '192.168.1.14';
bool isIpv4 = foo.isIpv4(); // returns true
String foo = '192.168.1.14.150.1225';
bool isIpv4 = foo.isIpv4(); // returns false

Libraries

string_extensions