UnitName$() 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 a string representing the full version of a standard MapInfo Pro unit name. You can call this function from the MapBasic window in MapInfo Pro.

Syntax

UnitName$( unit_name )

unit_name is a string representing a standard MapInfo Pro unit name (for example, "km")

Return Value

String expression, representing a full unit name (for example, "kilometers")

Description

The unit_name parameter must be one of MapInfo Pro's standard, English-language unit names, such as "km" (for kilometers) or "sq km" (for square kilometers).

The UnitName$() function returns a string representing the full version of the unit name. The exact string returned depends on whether the user is running the English-language version of MapInfo Pro or a translated version. For example, if a user is running the French-language version of MapInfo Pro, the following function call returns the French translation of "square kilometers":

UnitName$("sq km")

The UnitName$() function can operate on units of distance, area, paper, and time. For a listing of MapInfo Pro's standard distance unit names (for example, "km"), see Set Distance Units statement. For a listing of area unit names (for example, "sq km"), see Set Area Units statement. For a listing of paper unit names (for example, "in" for inches on a page layout), see Set Paper Units statement. Time unit names include seconds ("sec"), minutes ("min"), and hours ("hr").

The unit_name parameter can also be "degree" (in which case, UnitName$() returns "degrees").

See Also:

Set Area Units statement, Set Distance Units statement, Set Paper Units statement, UnitAbbr$() function