Trim

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

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

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