string-occurrence

2018-11-07 admin

string-occurrence是什么

什么是string-occurrence,Get the number of occurrences of a string in a string

string-occurrence使用教程帮助文档

string-occurrence Build Status

Get the number of occurrences of a string in a string

Install

$ npm install --save string-occurrence

Usage

const stringOccurrence = require('string-occurrence');

stringOccurrence('foo bar', 'foo');
//=> 1

stringOccurrence('foo bar\nfoo baz', 'foo');
//=> 2

stringOccurrence('foo bar\nfoo baz', ['foo', 'baz']);
//=> 3

API

stringOccurrence(input, search, [options])

input

Type: string

The string to search in.

search

Type: string, string[]

The keyword or keywords to search for.

options

caseInsensitive

Type: boolean Default: true

Perform a case insensitive match.

License

MIT © Sam Verschueren

本站文章除注明转载外,均为本站原创或编译。欢迎任何形式的转载,但请务必注明出处。

转载请注明:文章转载自 JavaScript中文网 [https://www.javascriptcn.com]

本文地址:https://www.javascriptcn.com/read-44784.html

文章标题:string-occurrence

回到顶部