Skip to content

Count case-sensitive occurrences of a string in a string (like needles in a haystack)

License

Notifications You must be signed in to change notification settings

radiovisual/needle-string

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

needle-string

Count case-sensitive occurrences of a string in a string (like needles in a haystack)

Build Status

Install

$ npm install --save needle-string

Usage

const needles = require('needle-string');

needles('magical unicorns are magic', 'magic');
//=> 2

API

needleString(haystack, needle)

Returns the number of case-sensitive strings ('needles') in a string ('haystack') of text.

haystack

Type: string

The string of text you want to search.

needle

Type: string

The string you want to count the occurrences of.

License

MIT © Michael Wuergler

About

Count case-sensitive occurrences of a string in a string (like needles in a haystack)

Resources

License

Stars

Watchers

Forks

Packages

No packages published