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