Giter Site home page Giter Site logo

anas35 / super_string Goto Github PK

View Code? Open in Web Editor NEW
0.0 0.0 0.0 39 KB

Some of the most common and useful string methods, Inspired by various other programming languages.

License: BSD 3-Clause "New" or "Revised" License

Dart 100.00%
dart dart-package extension-methods functions string-functions

super_string's Introduction

Super String

Pub test

Some of the most common and useful string methods, Inspired by various other programming languages.

Example:

import 'package:super_string/super_string.dart';

void main() {
  print('THIS'.isUpperCase); // => true
  print('this'.isLowerCase); // => true
  print('This123'.isAlNum); // => true
  print('This'.isAlpha); // => true
  print('123'.isInteger); // => true
  print('This_123'.isIdentifier); // => true
  print('Hello'.iterable); // => ['H','e','l','l','o']
  print('Hello'.first); // => 'H'
  print('Hello'.last); // => 'o'
  print('tHiS iS tiTle'.title()); // => 'This Is Title'
  print('tHiS'.swapcase()); // => 'ThIs'
  print('This'.charAt(0)); // => 'T'
  print('this'.similarity('THis')); // => 2
  print('this'.capitalize()); // => 'This'
  print('this'.center(7,'0')); // => '00this0'
  print('this'.count('t')); // => 1
  print('a\ta'.expandTabs(2)); // => 'a a'
  print('hello world'.toCamelCase()); // => 'HelloWorld'
  print('This is my code'.containsAll(['This','code'])); // => true
  print('This is my code'.containsAny(['code','hello'])); // => true
  print('Hello World'.wordWrap(width: 5)); // => 'Hello\nWorld'
}

Usage:

Command Description
isUpperCase Check if the characters are in UpperCase
isLowerCase Check if the characters are in LowerCase
isAlNum Check if the characters contains only Alphabets and Numbers
isAlpha Check if the characters contains only Alphabets
isInteger Check if the characters contains only Numbers
isIdentifier Check if the characters contains only Alphabets,Numbers and underscore( _ )
iterable Iterated all the character in a String
first Return the first character in a String
last Return the last character in a String
title() Convert only the first character of every words into UpperCase
swapcase() Convert UpperCase into LowerCase and vice versa
charAt() Return a character of a specified index
similarity() Count the number of common letter in both String
capitalize() Convert the first character of String into UpperCase
center() Return a centered string
count() Count the number of times a specified value occurs in a string
expandTabs() Sets the tab size of the string
toCamelCase() Convert the given string to camelCase
containsAll() Check if all the values in list are in String
containsAny() Check if any one of the values in list are in String
wordWrap() Return a String wrapped at the specified length

Features, Bugs and Contributing

If you encounter any bug or feature request, feel free to create a issue. If you want to contribute to this project select one of the issue and starting working on it.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.