EndsWith

EndsWith( value, search )
EndsWith( value, search )
EndsWith( value, search )
EndsWith( value, search )
ends_with( value, search )
EndsWith( value, search )

Description

The EndsWith function returns true when the value string ends with the search string, or false when it does not.

Parameters

Argument Type Definition and Requirements

value

The string to compare.

search

The string to search for at the end of value.

Returns

Returns a boolean: true when value ends with search, or false when it does not.

Examples

The following query demonstrates the case where the value string ends with the search string:

Value result = await client.Query(
    EndsWith("Fauna", "a")
);
BooleanV(True)
result, err := client.Query(
	f.EndsWith("Fauna", "a"))

if err != nil {
	fmt.Fprintln(os.Stderr, err)
} else {
	fmt.Println(result)
}
true
System.out.println(
    client.query(
        EndsWith("Fauna", "a")
    ).get()
);
true
client.query(
  q.EndsWith('Fauna', 'a')
)
.then((ret) => console.log(ret))
.catch((err) => console.error('Error: %s', err))
true
result = client.query(
  q.ends_with("Fauna", "a")
)
print(result)
True
println(Await.result(
  client.query(
    EndsWith("Fauna", "a")
  ),
  5.seconds
))
true

The following query demonstrates the case where the value string does not end with the search string:

Value result = await client.Query(
    EndsWith("Fauna", "A")
);
BooleanV(False)
result, err := client.Query(
	f.EndsWith("Fauna", "A"))

if err != nil {
	fmt.Fprintln(os.Stderr, err)
} else {
	fmt.Println(result)
}
false
System.out.println(
    client.query(
        EndsWith("Fauna", "A")
    ).get()
);
false
client.query(
  q.EndsWith('Fauna', 'A')
)
.then((ret) => console.log(ret))
.catch((err) => console.error('Error: %s', err))
false
result = client.query(
  q.ends_with("Fauna", "A")
)
print(result)
False
println(Await.result(
  client.query(
    EndsWith("Fauna", "A")
  ),
  5.seconds
))
false

Was this article helpful?

We're sorry to hear that.
Tell us how we can improve!
Visit Fauna's Discourse forums or email docs@fauna.com

Thank you for your feedback!