Simplicty and flexibility!


Function::String

LastW
LastW(TEXT VALUE,n)
LastW("My long sentence with a lot of words",3)
LastW(MyTextField,NumberOfWordsFromEnd)


The lastw function extracts a specified number of words from the end (right) of a text value.

lastw(FIELDNAME, n) returns the last n words in the field including intervening spaces and punctuation symbols. If there are n or fewer words in the field, lastw returns the original text value.

Parameters


TEXT VALUE

The Text string from which I want to copy n number of words from the end.

n

The number of words I want to copy from TEXT VALUE

Returns/Result


A text value n words in length.

Examples


Examples


lastw( "Sapphire International Ltd." , 2)

Returns: International Ltd.


lastw( "Club ParaDEASE" , 1)

Returns: ParaDEASE


lastw( STREET, 2)

Returns:The last two words in the STREET field for every record that is processed. If a record contains the value "540 Avenida de los Delfines" in the STREET field, the function returns "los Delfines".


Reference

lastw

Type

Text Function

Purpose

The lastw function extracts a specified number of words from the end (right) of a text value.

Syntax

lastw( TEXT VALUE, n)

Returns

A text value n words in length.

Usage

lastw(FIELDNAME, n) returns the last n words in the field including intervening spaces and punctuation symbols. If there are n or fewer words in the field, lastw returns the original text value.

Examples

lastw( "Sapphire International Ltd." , 2)

Returns: International Ltd.

 

lastw( "Club ParaDEASE" , 1)

Returns: ParaDEASE

 

lastw( STREET, 2)

Returns:The last two words in the STREET field for every record that is processed. If a record contains the value "540 Avenida de los Delfines" in the STREET field, the function returns "los Delfines".

See Also


FirstLast
LastFirst
MidW
FirstW

On the forum about LastW

On the blog about LastW


dg3_HelpView