FQL v4 will be decommissioned on June 30, 2025. Ensure that you complete your migration from FQL v4 to FQL v10 by that date.

For more details, review the migration guide. Contact support@fauna.com with any questions.

Trim

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

Trim( value )
trim( value )
Trim( value )
Trim( value )
Trim( value )

Description

The Trim function returns a string which has both the leading and trailing white spaces, tabs, and new lines removed from the string.

Parameters

Parameter Type Definition and Requirements

value

String

The string that should have any leading and trailing white spaces, tabs, and newlines removed.

Returns

A String which has both the leading and trailing white spaces, tabs, and newlines removed.

Examples

client.query(
  [
    q.Trim('Fire   '),
    q.Trim('    Fire    '),
    q.Trim('    \n\n\t\tFire\n\n\t\t    '),
  ]
)
.then((ret) => console.log(ret))
.catch((err) => console.error(
  'Error: [%s] %s: %s',
  err.name,
  err.message,
  err.errors()[0].description,
))
[ 'Fire', 'Fire', 'Fire' ]
result = client.query(
  [
    q.trim("Fire   "),
    q.trim("    Fire    "),
    q.trim("    \n\n\t\tFire\n\n\t\t    "),
  ]
)
print(result)
['Fire', 'Fire', 'Fire']
result, err := client.Query(
	f.Arr{
		f.Trim("Fire   "),
		f.Trim("    Fire    "),
		f.Trim("    \n\n\t\tFire\n\n\t\t    "),
	})

if err != nil {
	fmt.Fprintln(os.Stderr, err)
} else {
	fmt.Println(result)
}
[Fire Fire Fire]
try
{
    Value result = await client.Query(
        Arr(
            Trim("Fire   "),
            Trim("    Fire    "),
            Trim("    \n\n\t\tFire\n\n\t\t    ")
        )
    );

    Console.WriteLine(result);
}
catch (Exception e)
{
    Console.WriteLine($"ERROR: {e.Message}");
}
Arr(StringV(Fire), StringV(Fire), StringV(Fire))
[
  Trim('Fire   '),
  Trim('    Fire    '),
  Trim('    \n\n\t\tFire\n\n\t\t    '),
]
[ 'Fire', 'Fire', 'Fire' ]
Query metrics:
  •    bytesIn:  84

  •   bytesOut:  35

  • computeOps:   1

  •    readOps:   0

  •   writeOps:   0

  •  readBytes:   0

  • writeBytes:   0

  •  queryTime: 2ms

  •    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!