Click or drag to resize

string.startswith Function

Verizon Connect Logo
Print this page
Learn more about Verizon Connect GeoBase.
Get information about the latest release
string.startswith Function

The string.startswith function determines whether a given string starts with a second string.

Syntax

Alchemy
string.startswith(str, cmp);

Nomenclature

strA string expression
cmp A string expression to compare with the start of str

Returns

True if str starts with cmp, otherwise returns false. The test is case-sensitive.

Examples

Alchemy
$myString = "Telogis";
PRINT string.startswith($myString, "Tel");
PRINT string.startswith($myString, "tel");
PRINT string.startswith($myString, "ted");

The above code snippet produces the following output:

True

False

False

The string.startswith function is commonly used when importing data to ensure names are correctly formatted:

Alchemy
IMPORT STREETS [
  ID = %id,
  ...
  NAME = string.startswith(%fullname, "I ") ? "I-" + substring(%fullname, 2) :
    string.startswith(%fullname, "Hwy ") ? "SR-" + substring(%fullname, 4) : 
      %fullname,
  ...
]