Skip to content

springuper/ex-indexof

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Extended-IndexOf

Extended indexOf for specific occurrence time.

var exIndexOf = require('ex-indexof');

exIndexOf('hello, world', 'o'); // => 4
exIndexOf('hello, world', 'o', 1); // => 8
exIndexOf('hello, world', 'o', 2); // => -1

// reverse direction
exIndexOf('hello, world', 'o', -1); // => 8
exIndexOf('hello, world', 'o', -2); // => 4
exIndexOf('hello, world', 'o', -3); // => -1

// substring
exIndexOf('too simple, too young, sometime naive', 'too', -2); // => 0

About

extend indexof for custom substring location

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published