Skip to content

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

License

Notifications You must be signed in to change notification settings

Anas35/super_string

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

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

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages