1.0.1 • Published 10 years ago

cut-substring v1.0.1

Weekly downloads
7
License
MIT
Repository
github
Last release
10 years ago

cut-substring Build Status Coverage Status

Cut a substring from a string by index or RegExp.

Install

npm install cut-substring

Usage

Cut by index

var cutSubstr = require('cut-substring');

var startIndex = 4;
var endIndex = 10;

cutSubstr('Some string', startIndex, endIndex);
//=> Some

Cut by RegExp

var cutSubstr = require('cut-substring');

var startRE = /^[a-z]+/i;
var endRE = /\-/;

cutSubstr('Some-string', startRE, endRE);
//=> string

API

cutSubstr(str, start, end)

str

Required
Type: string

start

Required
Type: number or RegExp

end

Type: number or RegExp
Default: str.length

License

The MIT License

1.0.1

10 years ago

1.0.0

10 years ago