EndsWith

This reference topic applies to FQL v4. Go to this page for the latest FQL v10 reference topics.

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

Parameter Type Definition and Requirements

value

String

The String to compare.

search

String

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:

try
{
    Value result = await client.Query(
        EndsWith("Fauna", "a")
    );
    Console.WriteLine(result);
}
catch (Exception e)
{
    Console.WriteLine($"ERROR: {e.Message}");
}
BooleanV(True)
result, err := client.Query(
	f.EndsWith("Fauna", "a"))

if err != nil {
	fmt.Fprintln(os.Stderr, err)
} else {
	fmt.Println(result)
}
true
client.query(
  q.EndsWith('Fauna', 'a')
)
.then((ret) => console.log(ret))
.catch((err) => console.error(
  'Error: [%s] %s: %s',
  err.name,
  err.message,
  err.errors()[0].description,
))
true
result = client.query(
  q.ends_with("Fauna", "a")
)
print(result)
True
EndsWith('Fauna', 'a')
true
Query metrics:
  •    bytesIn:  33

  •   bytesOut:  17

  • computeOps:   1

  •    readOps:   0

  •   writeOps:   0

  •  readBytes:   0

  • writeBytes:   0

  •  queryTime: 2ms

  •    retries:   0

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

try
{
    Value result = await client.Query(
        EndsWith("Fauna", "A")
    );
    Console.WriteLine(result);
}
catch (Exception e)
{
    Console.WriteLine($"ERROR: {e.Message}");
}
BooleanV(False)
result, err := client.Query(
	f.EndsWith("Fauna", "A"))

if err != nil {
	fmt.Fprintln(os.Stderr, err)
} else {
	fmt.Println(result)
}
false
client.query(
  q.EndsWith('Fauna', 'A')
)
.then((ret) => console.log(ret))
.catch((err) => console.error(
  'Error: [%s] %s: %s',
  err.name,
  err.message,
  err.errors()[0].description,
))
false
result = client.query(
  q.ends_with("Fauna", "A")
)
print(result)
False
EndsWith('Fauna', 'A')
false
Query metrics:
  •    bytesIn:  33

  •   bytesOut:  18

  • computeOps:   1

  •    readOps:   0

  •   writeOps:   0

  •  readBytes:   0

  • writeBytes:   0

  •  queryTime: 3ms

  •    retries:   0

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!