Start sharing components as a team!Share components as a team!Join Bit to build your applications faster.Get Started Free

contains

v1.0.0arrow_drop_down
v1.0.0
v0.0.1
STATUS
Passing
DOWNLOADS
26
LICENSE
MIT
VISIBILITY
Public
PUBLISHED
2 years ago
SIZE
489 B
determines whether string `str` ref contains substring `searchRef`.
2 contributors
Use contains in your project ?
Copied
npm i @bit/bit.utils.string.contains
Set Bit as a scoped registryLearn more
npm config set '@bit:registry' https://node.bit.dev
Component Example
React
React
Vue
Angular
Add dependency... help_outline
Just
import
any of the 1 million components
and packages in Bit or NPM to the example.
import Button from '@bit/grommet.grommet.button';
import Lodash from 'lodash';
revert changes
reload
toggle layout
maximize
contains("foo bar", "bar"); // => true
contains("foo", "bar"); // => false
modifieddraft
chevron_left
chevron_right
contains (
str:string,
searchStr:string
) : boolean

determines whether string str ref contains substring searchRef.

Example
contains('foo bar', 'bar') // => true
 contains('foo', 'bar') // => false
Arguments
str: string
searchStr: string
Returns
boolean

Test Summary

contains should return true as substring foo exists in foo bar

Pass

contains should return false as substring x do not exists in string foo

Pass