LTrim

LTrim( value )
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

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.

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))
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]
System.out.println(
    client.query(
        Arr(
            LTrim(" Fire"),
            LTrim("\t\n\r    Fire")
        )
    ).get());
["Fire", "Fire"]
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']
[
  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!