Left

Extract the leftmost count characters from a string

Method Signature

Left(string=[string], count=[integer])

Arguments

Argument
Type
Required
Description
Default

string

string

true

The string to extract from

count

integer

true

The number of characters to retrieve.

Examples

Using left() on a string

In this example we'll use left() to return part of a string.

Run Example

writeOutput( left( "The quick brown fox jumped over the lazy dog", 19 ) );

Result: The quick brown fox

Using left() with a negative count on a string

In this example we'll use a negative count to return part of a string.

Run Example

Result: The quick brown fox

Using left() in a function

In this example we'll use left() in a function to help us to capitalize the first letter in a string.

Run Example

Using left() to test values

In this example we'll use left() to test the first five characters of a request context variable.

Using left() as a member function

In this example we'll use left() as a member function inside a function to help us to capitalize the first letter in a string.

Run Example

Additional Examples

Run Example

Last updated

Was this helpful?