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, see the v4 EOL announcement and migration guide. Contact support@fauna.com with any questions.

LTrim

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

LTrim( value )
ltrim( value )
LTrim( value )
LTrim( value )
LTrim( value )

Description

The LTrim function removes all white spaces, tabs, and newlines from the beginning of the provided string.

Parameters

Parameter Type Definition and Requirements

value

String

The String from which to remove leading spaces, tabs, and newlines.

Returns

A String which has all of the leading white spaces, tabs, and newlines removed.

Examples

The following query executes an array of independent LTrim operations and returns the results in an array. The result array position matches the execution array position. The individual operations are:

  1. The string " Fire" is processed, resulting in "Fire" which becomes the first item in the result array.

  2. The string "\t\n Fire" is processed, resulting in "Fire", which becomes the second item in the result array.

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

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

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

  •   bytesOut:  28

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