package
Get the number of occurrences of a string in a string
npm install string-occurrenceGitHub-flavored package documentation.
Across all versions.
Download trend unavailable.
Runtime metadata.
Tagged topics.
Estimated unpacked size across 3 packages.
3.6 kB
Includes dependencies.
Get the number of occurrences of a string in a string
$ npm install --save string-occurrenceconst stringOccurrence = require('string-occurrence');
stringOccurrence('foo bar', 'foo');
//=> 1
stringOccurrence('foo bar\nfoo baz', 'foo');
//=> 2
stringOccurrence('foo bar\nfoo baz', ['foo', 'baz']);
//=> 3Type: string
The string to search in.
Type: string, string[]
The keyword or keywords to search for.
Type: boolean
Default: true
Perform a case insensitive match.
MIT © Sam Verschueren