LTrim() and RTrim() Function in MS Access

1. LTrim() Function :
In MS Access LTrim() function remove all the leading spaces from the given string. In LTrim() function a string will be pass as a parameter and it will return the string with no leading spaces.

Syntax :

LTrim(string)

Example-1 :

SELECT LTrim("    w3wiki") AS LeftTrimmedString;

Output –

LeftTrimmedString
w3wiki

Example-2 :

SELECT LTrim("    GFG") AS LeftTrimmedString;

Output –

LeftTrimmedString
GFG

2. RTrim() Function :
It works same like LTrim() function but it will remove all trailing spaces from a string.

Syntax :

RTrim(string)

Example-1 :

SELECT RTrim("w3wiki    ") AS RightTrimmedString;

Output –

RightTrimmedString
w3wiki

Example-2 :

SELECT RTrim("GFG    ") AS RightTrimmedString;

Output –

RightTrimmedString
GFG

Contact Us