CLIP (return string without trailing spaces)

Top  Previous  Next

 

CLIP(string)

CLIP

Removes trailing spaces.

string

A string expression.

The CLIP procedure removes trailing spaces from a string. The return string is a substring with no trailing spaces. CLIP is frequently used with the concatenation operator in string expressions using STRING data types.

CLIP is not needed with CSTRING data types, since these have a terminating character. CLIP is also not needed with PSTRING data types, since these have a length byte.

When used in conjunction with the LEFT procedure, you can remove both leading and trailing spaces (frequently called ALLTRIM in other languages).

Return Data Type:

STRING

Example:

Name = CLIP(Last) & ', ' & CLIP(First) & Init & '.'  !Full name in military order

 

Name = CLIP(First) & CLIP(' ' & Middle) & ' ' & Last !Full name with or with middle

 

AllTrimVar = CLIP(LEFT(MyVar))                       !Trim leading and trailing spaces at once

 

See Also:

LEFT