Right$() function - MapBasic - 2023

MapInfo MapBasic Reference

Product type
Software
Portfolio
Locate
Product family
MapInfo
Product
MapInfo > MapBasic
Version
2023
Language
English
Product name
MapBasic
Title
MapInfo MapBasic Reference
First publish date
1985
Last updated
2023-09-12
Published on
2023-09-12T16:32:32.686312

Purpose

Returns part or all of a string, beginning at the right end of the string. You can call this function from the MapBasic window in MapInfo Pro.

Syntax

Right$( string_expr, num_expr ) 

string_expr is a string expression.

num_expr is a numeric expression.

Return Value

String

Description

The Right$() function returns a string which consists of the rightmost num_expr characters of the string expression string_expr.

The num_expr parameter should be an integer value, zero or larger. If num_expr has a fractional value, MapBasic rounds to the nearest integer. If num_expr is zero, Right$() returns a null string. If num_expr is larger than the number of characters in the string_expr string, Right$() returns a copy of the entire string_expr string.

Example

Dim whole, partial As String
whole = "Afghanistan"
partial = Right$(whole, 4)

' at this point, partial contains the string: "stan" 

See Also:

Left$() function, Mid$() function