Skip to content

contains()

Functionality

Returns true/false if the string contains the specified substring provided in function parameter.

Syntax

How does it work?

The contains() function returns the boolean(true/false) if the specified substring provided in function parameter is present in the string datatype.

if the value dose not exist or null, it will return default false.

this function is only supported with str datatype.

Example

coffeeshop(base class) language properties

TypeNameValue
strnamesample coffeeshop
straddressb/11, mg road

source

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
<div>
    <!-- for str datatyp it will show 'This is coffeeshop' 
        only if the coffeeshop description contains 'coffee' -->
    <span k-show="">
        This is coffee shop
    </span>
      <span k-hide="">
        This is not coffee shop
    </span>
</div>

output

1
2
3
4
5
<div>
    <span>
        This is coffee shop
    </span>
</div>