Page tree
Skip to end of metadata
Go to start of metadata




Introduced in

Version:3.7

Description

Description: Checks whether the passed string is a valid coordinate component.

Syntax

Syntax: [coord, allowEmpty, format] call fn_vbs_validateCoords
Parameters:
  • coord: String - Coordinate component to validate.
  • allowEmpty: Boolean - If true, then an empty coord string will be considered valid. If false, then 'coord' cannot be empty.
  • format: String - The type of coordinate component that should be allowed in 'coord'. Can be:
    • "LL_DEG_LAT" or "LL_DEG_LONG - Input must be a number with no more than 10 digits (incl. decimal point), between 0 and 9999999999.
    • "LLMS_MIN_LAT" or "LLMS_MIN_LONG" - Input must be a number with no more than 9 digits (incl. decimal point), between 0 and 99.999999.
    • "LLMS_SEC_LAT" or "LLMS_SEC_LONG" - Input must be a number with no more than 9 digits (incl. decimal point), between 0 and 99.999999.
    • "UTM_ZONE" - Input must be a number with no more than 2 digits, between 0 and 99.
    • "UTM_EAST" - Input must be a number with no more than 9 digits (incl. decimal point), between 0 and 999999.99.
    • "UTM_NORTH" - Input must be a number with no more than 10 digits (incl. decimal point), between 0 and 9999999.99.
    • "VBS_X" or "VBS_Y" - Input must be a number with no more than 15 digits (incl. decimal point), between 0 and 9999999.9999999.
    • "VBS_Z" - Input must be a number with no more than 12 digits (incl. decimal point), between 0 and 9999.9999999.
    • "MGRS_GZD" - Input must be a maximum of 3 characters, with the first two digits being 0-9, and the third one a character between C & X (excluding "I" or "O").
    • "MGRS_SQID" - Input must be a maximum of 2 characters, with the first between A-Z and second between A-V, neither of which may include "I" or "O".
    • "MGRS_EAST" or "MGRS_NORTH" - Input must be a number with no more than 5 digits, between 0-99999.
Return Value: Boolean - If true, then coordinate is either valid, or empty (if allowed).

Warning

When using functions in VBS versions older than 3.4, certain limitations and requirements should be kept in mind - the main ones being that capitalization of the function name is crucial, and that #include "\vbs2\headers\function_library.hpp" has to be included in every script that utilizes it. More Category VBS Scripting Functions.

Examples

Examples:
_chk = ["20", false, "VBS_X"] call fn_vbs_validateCoords;    // returns true
_chk = ["bob", false, "VBS_X"] call fn_vbs_validateCoords;   // returns false (invalid input)
_chk = ["VJ", true, "MGRS_SQID"] call fn_vbs_validateCoords; // returns true
_chk = ["20", true, "MGRS_SQID"] call fn_vbs_validateCoords; // returns false (invalid input)
_chk = ["", true, "MGRS_SQID"] call fn_vbs_validateCoords;   // returns true (empty allowed)
_chk = ["", false, "MGRS_SQID"] call fn_vbs_validateCoords;  // returns false (empty not allowed)

Additional Information

See also: fn vbs validateNumber, fn vbs validateGPSCoord
Multiplayer: 
Problems:In V3.7 the 'format' strings are case-sensitive, and the function would return true if an undefined 'format' type is passed.

Notes