/dart_more_functions

A dart package which provides a lot of helpers functions for easy development.

Primary LanguageDartMIT LicenseMIT

more_functions

Pub Version Github stars License Style

A dart package which provides a lot of helpers functions for easy development.

Installation

  1. Add this to your packages pubspec.yaml file:
dependencies:
  more_functions: <^last-version>
  1. Install it You could run pub get:
$ dart pub get
  1. Import it Now in Dart code, you can use:
import 'package:more_functions/more_functions.dart';

Overview

List of Helpers type:

  1. String

String

  1. Case
    1. Case Assertions
    2. Upper Case
    3. Lower Case
  2. Char
    1. Char Assertions
    2. Char Getters
    3. Char Position
    4. Char Transformation
  3. Word
    1. Word Getters
    2. Word Position
    3. Word Transformation
  4. Generic Utils
    1. Counters
    2. Symbol
      1. Add Symbol
      2. Remove Symbol
      3. Assertion Symbol
    3. Whitespace
      1. Add Whitespace
      2. Remove Whitespace
      3. Assertion Whitespace

CASE

Case Assertions

//entire string
print('Dart is awesome!'.isUpperCase); // false
print('Dart is awesome!'.isLowerCase); // false

//characters
print('Dart is awesome!'.firstCharIsUpperCase); // true
print('Dart is awesome!'firstCharIsLowerCase); // false
print('Dart is awesome!'.lastCharIsUpperCase); // false
print('Dart is awesome!'.lastCharIsLowerCase); // true
print('Dart is awesome!'.charAtIsUpperCase(1)); // ['a'] false
print('Dart is awesome!'.charAtIsLowerCase(1)); // ['a'] true

//words
print('Dart is awesome!'.firstWordIsUpperCase); // false
print('Dart is awesome!'firstWordIsLowerCase); // false
print('Dart is awesome!'.lastWordIsUpperCase); // false
print('Dart is awesome!'.lastWordIsLowerCase); // true
print('Dart is awesome!'.wordAtIsUpperCase(1)); // ['is'] false
print('Dart is awesome!'.wordAtIsLowerCase(1)); // ['is'] true

Upper Case

print('dart'.firstCharToUpperCase()); // 'Dart'
print('dart'.firstCharToLowerCase()); // 'darT'
print('upper camel case'.toUpperCamelCase()); // 'Upper Camel Case'
print('upper underscore case'.toUpperSnakeCase()); // 'UPPER_UNDERSCORE_CASE'
print('upper kebab case'.toUpperKebabCase()); // 'UPPER-KEBAB-CASE'

Lower Case

print('DART'.firstCharToLowerCase()); // 'dART'
print('DART'.firstCharToLowerCase()); // 'DARt'
print('LOWER CAMEL CASE'.toLowerCamelCase()); // 'lower Camel Case'
print('LOWER SNAKE CASE'.toLowerSnakeCase()); // 'lower_underscore_case'
print('LOWER KEBAB CASE'.toLowerKebabCase()); // 'lower-kebab-case'

Char

Char Assertions

print('Dart is awesome!'.hasChars); // true 
print('Dart is awesome!'.hasOnlyChars); // false  
print('Dart is awesome!'.hasOnlyUpperChars); // false   
print('Dart is awesome!'.hasOnlyLowerChars); // false

Char Getters

print('dart'.firstChar); // returns 'd'
print('dart'.lastChar); // returns 't'
print('dart'.charAt(1)); // returns 'a'

Char Position

print('dart'.lastCharIndex); // returns 3
print('dart'.indexOfChar('a')); // returns 1

Char Transformation

print('dart'.toChars()); // returns ['d','a','r','t']

Word

Word Getters

print('Dart is awesome!'.firstWord); // 'Dart' 
print('Dart is awesome!'.lastWord); // 'awesome!'  
print('Dart is awesome!'.wordAt(1)); // 'is'   

Word Position

print('Dart is awesome!'.indexOfWord('Dart')); // returns 0 

Word Transformation

print('Dart is awesome!'.toWords()); // ['Dart','is','awesome!'] 

Generic Utils

Counters

print('Dart is awesome!'.countChar()); // 16
print('Dart is awesome!'.countWord()); // 3

Symbol

Add Symbol

Not implemented yet.

Remove Symbol
print('Dart Is Awesome!'.removeAllSymbols); // 'Dart Is Awesome'
Assertion Symbol
print('Dart is awesome!'.hasSymbols); // true
print('Dart is awesome!'.hasOnlySymbols); // false

Whitespace

Add Whitespace

Not implemented yet.

Remove Whitespace
print('Dart Is Awesome!'.removeAllWhitespaces); // 'DartIsAwesome!'
Assertion Whitespace
print('Dart is awesome!'.hasWhitespaces); // true
print('Dart is awesome!'.hasOnlyWhitespaces); // false

return up