Check out v4 of the Fauna CLI

v4 of the Fauna CLI is now in beta.

The new version introduces enhancements to the developer experience, including an improved authentication workflow. To get started, check out the CLI v4 quick start.

string.startsWith()

Test whether a String starts with the given String.

Signature

startsWith(otherString: String) => Boolean

Description

The startsWith() method determines whether the String begins with starts with otherString. An exact match returns true.Otherwise, the method returns false.

Parameters

Parameter Type Required Description

otherString

String

Yes

String to compare with the start of this String.

Return value

Type Description

Boolean

String comparison result:
true = Calling string starts with otherString.
false = Calling string doesn’t start with otherString.

Examples

  1. Test whether a String starts with HTTP:

    "HTTP/1.1 200 OK".startsWith("HTTP")
    true
  2. Test whether a String starts with 200:

    "HTTP/1.1 200 OK".startsWith("200")
    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!