@Contains (JavaScript)
Determines whether a string contains a substring.
Defined in
@Functions (JavaScript)Syntax
@Contains(value:string, subString:string)
: int
Parameter | Description |
---|---|
value |
The string to be checked. |
substring |
The substring to be checked. |
Return value | Description |
---|---|
int |
1 if true, 0 otherwise. |
Usage
This function is case-sensitive.
Examples
This example checks for a substring within a string twice returning 1 and 0.function p(stuff) {
print("<<<" + stuff + ">>>");
}
var s1 = "Now is the time.";
var s2 = "is";
if(@Contains(s1, s2) == @True())
p("String s1 contains with " + s2);
else
p("String s1 does not contain " + s2);
s2 = "iz";
if(@Contains(s1, s2) == @True())
p("String s1 contains with " + s2);
else
p("String s1 does not contain " + s2);