includes()

Test if the String includes a given String.

Signature

includes(otherString: String): Boolean

Description

The includes() method determines if otherString occurs in this String. The method returns true if an exact match is found. Otherwise, the method returns false.

Parameters

Parameter Type Required Description

otherString

String

Yes

String to search for in this String.

Return value

Type Description

Boolean

String found status:
true = Calling string has otherString.
false = Calling string doesn’t have otherString.

Examples

  1. Test if the calling string includes the String 200:

    "HTTP/1.1 200 OK".includes("200")
    true
  2. Test if the calling string includes the String 400:

    "HTTP/1.1 200 OK".includes("400")
    false

Is this article helpful? 

Tell Fauna how the article can be improved:
Visit Fauna's forums or email docs@fauna.com

Thank you for your feedback!