DataBasic Reference > MultiValue Compatibility > Statements and Intrinsic Functions > RIGHT Function

Comment on this topic

Documentation Comments

Use this form to comment on this topic. You can also provide any general observations about the Online Documentation, or request that additional information be added in a future release.

Reality V15.0 ()

RIGHT Function (DataBasic MultiValue Compatibility) (m6187ai+right_f.htm)

To

Reality

Version

Topic

Submitted by

Company

Location

Email address

Comment

 

 

RIGHT Function

Returns the specified number of characters from the end of a string.

This function is provided for compatibility with other MultiValue systems.

Syntax

RIGHT(string, charCount)

Syntax Elements

string A DataBasic expression that evaluates to a string.

charCount A DataBasic expression that evaluates to the number of characters to extract. Only the integer part is used.

Return Value

A string containing the specified number of characters from the end of the string.

Operation

The RIGHT function is equivalent to the following substring extraction operation:

string[-charCount, charCount]

If charCount is negative, the result is the substring starting at charCount and ending charCount for the end. As a result, if charCount is greater than half the length of string, an empty string is returned.

See Also

LEFT function, Substring Extraction.

Examples

S = "123456789"
C = 7
R = RIGHT(S, C)

Sets R to "3456789".

S = "123456789"
C = -3
R = RIGHT(S, C)

Sets R to "34567".

S = "123456789"
C = 12
R = RIGHT(S, C)

Because C is greater than the length of the string, sets R to an empty string.

RealityV15.0Comment on this topic