contains
Checks if a string contains another string.
Description
vcc.contains(haystack: string, needle: string): boolean
Searches the needle in the haystack.
Parameters
haystack
It looks for the needle within this string.
needle
It looks for this element within the haystack.
Return values
Returns true if the needle is found in the haystack, false otherwise.
Example
We have a comma-separated list of allowed postal codes, and we want to check the given one.
const allowedValues = '2034,2579,1069,5173';
if (!vcc.contains(allowedValues, '2034')) {
vcc.alert('The post code is not allowed');
}
Comments
Can’t find what you need? Use the comment section below to connect with others, get answers from our experts, or share your ideas with us.
There are no comments yet.