Functions for formatting text values. These are commonly used in the labeling and popup profiles.
Concatenate
Concatenate(values?, separator?, format?) -> Text
Function bundle: Core
Concatenates values together and returns a text value.
Parameters
- values (Optional): Array<Text> - An array of text values to concatenate.
- separator (Optional): Text - Separator to use for concatenation if
values
parameter is an array. Or text to concatenate, if a single value is provided for the first parameter. If not provided will be empty. - format (Optional): Text - Special formatting characters for dates or numbers. This parameter is available in Arcade version 1.3 and later.
Possible values:0
: Digit#
: Digit, omitting leading/trailing zerosD
: Day of the month, not padded (1 - 31)DD
: Day of the month, padded (01 - 31)DDD
: Ordinal day of the year (1 - 365)d
: Day of the week (1 - 7)ddd
: Abbreviated day of the week (e.g. Mon)dddd
: Full day of the week (e.g. Monday)M
: Month number (1 - 12)MM
: Month number, padded (01 - 12)MMM
: Abbreviated month name (e.g. Jan)MMMM
: Full month name (e.g. January)Y
: Full yearYY
: Two-digit yearh
: Civilian hours, not padded (0 - 12)hh
: Civilian hours, padded (00 - 12)H
: Military hours, not padded (0 - 24)HH
: Military hours, padded (00 - 24)m
: Minutes, not padded (0 - 59)mm
: Minutes, padded (00 - 59)s
: Seconds, not padded (0 - 59)ss
: Seconds, padded (00 - 59)SSS
: Milliseconds, padded (000 - 999)A
: AM/PMZ
: Time zone offset in narrow hours +/- UTC (e.g.-7
or+11
)ZZ
: Time zone offset in hours +/- UTC (e.g.-07
or:00 +11
):00 ZZZ
: Time zone offset in compact hours +/- UTC (e.g.-0700
or+1100
)ZZZZ
: Abbreviated named time zone (e.g.EST
)ZZZZZ
: Named time zone (e.g.Eastern Standard Time
)
Return value: Text
Example
prints 'red/blue/green'
Concatenate(['red', 'blue', 'green'], '/')
Count
Count(value) -> Number
Function bundle: Core
Returns the number of characters in a text value.
Parameter
- value: Text - A text value on which to perform the operation.
Return value: Number
Example
Returns 13
Count('Graham County')
Find
Find(searchText, targetText, startPosition?) -> Number
Function bundle: Core
Finds a sequence of characters within a text value. Wildcards are NOT supported. A returned value of -1
indicates no results were found.
Parameters
- searchText: Text - The text to search for.
- targetText: Text - The text to search.
- startPosition (Optional): Number - The zero-based index of the character in the text to search from.
Return value: Number
Example
prints 6
Find('380', 'Esri, 380 New York Street', 0)
FromCharCode
FromCharCode(charCode1, [charCode2, ..., charCodeN]?) -> Text
Function bundle: Core
Returns a text value created from a sequence of UTF-16 character codes.
Parameters
- charCode1: Number - A number representing UTF-16 code units. Each unit has a range of 0-65535.
- [charCode2, ..., charCodeN] (Optional): Number - A sequence of numbers representing UTF-16 code units. Each unit has a range of 0-65535.
Return value: Text
Examples
The following example returns 'XYZ'
FromCharCode(88,89,90)
// returns 'XYZ'
The following example returns '🌉'
FromCharCode(55356, 57097)
// returns '🌉'
FromCodePoint
FromCodePoint(codePoint1, [codePoint2, ..., codePoint1N]?) -> Text
Function bundle: Core
Returns a text value created from a sequence of UTF-32 code points.
Parameters
- codePoint1: Number - A code point.
- [codePoint2, ..., codePoint1N] (Optional): Number - A list of code points
Return value: Text
Examples
The following example returns 'XYZ'
FromCodePoint(88,89,90)
// returns 'XYZ'
The following example returns '🌉'
FromCodePoint(127753)
// returns '🌉'
Guid
Guid(guidFormat?) -> Text
Function bundle: Core
Returns a random GUID as a text value.
Parameter
- guidFormat (Optional): Text - An named format for the GUID. The default value is
digits-hyphen-braces
.
Possible Values:digits
|digits-hyphen
|digits-hyphen-braces
|digits-hyphen-parentheses
Return value: Text
Examples
Returns a value similar to {db894515-ed21-4df1-af67-36232256f59a}
Guid()
Returns a value similar to d00cf4dffb184caeb8ed105b2228c247
Guid('digits')
Left
Left(value, charCount) -> Text
Function bundle: Core
Returns the specified number of characters from the beginning of a text value.
Parameters
- value: Text - The value from which to get characters.
- charCount: Number - The number of characters to get from the beginning of the text.
Return value: Text
Example
prints 'the'
Left('the quick brown fox', 3)
Lower
Lower(inputText) -> Text
Function bundle: Core
Makes a text value lower case.
Parameter
- inputText: Text - The text to be made lowercase.
Return value: Text
Example
prints 'hello'
Lower('HELLO')
Mid
Mid(value, startPosition, charCount?) -> Text
Function bundle: Core
Gets a number of characters from the middle of a text value.
Parameters
- value: Text - The value from which to get characters. If the value is not of type Text, the value is first converted to Text.
- startPosition: Number - The starting position from which to get the text. 0 is the first position.
- charCount (Optional): Number - The number of characters to extract. If omitted, extracts characters to the end of the Text
Return value: Text
Example
prints 'quick'
Mid('the quick brown fox', 4, 5)
Proper
Proper(inputText, applyToText?) -> Text
Function bundle: Core
Converts a text value to title case. By default, the beginning of every word is capitalized. The option firstword
will capitalize only the first word.
Parameters
- inputText: Text - The text to convert to title case.
- applyToText (Optional): Text - A text value specifying the type of capitalization to be performed. By default every word is capitalized. This parameter accepts one of two values:
everyword
orfirstword
.
Return value: Text
Example
prints 'The Quick Brown Fox'
Proper('the quick brown fox', 'everyword')
Replace
Replace(value, searchText, replacementText, allOccurrences?) -> Text
Function bundle: Core
Replaces characters within a text value. Defaults to replacing all occurrences.
Parameters
- value: Text - The text in which to make replacements.
- searchText: Text - The text to search for.
- replacementText: Text - The replacement text.
- allOccurrences (Optional): Boolean - Indicates if all occurrences of the
search
should be replaced in the text. Defaults toText true
.
Return value: Text
Example
prints 'the quick red fox'
Replace('the quick brown fox', 'brown', 'red')
Right
Right(value, charCount) -> Text
Function bundle: Core
Returns the specified number of characters from the end of a text value.
Parameters
- value: Text - The text from which to get characters.
- charCount: Number - The number of characters to get from the end of the text value.
Return value: Text
Example
prints 'fox'
Right('the quick brown fox', 3)
Split
Split(inputText, separatorText, limit?, removeEmpty?) -> Array<Text>
Function bundle: Core
Splits a text value into an array.
Parameters
- inputText: Text - The text value to be split.
- separatorText: Text - The separator used to split the text.
- limit (Optional): Number - An integer that specifies the number of splits. The default is
-1
, which indicates an unlimited number of splits. - removeEmpty (Optional): Boolean - Indicates whether to remove empty values. By default this is
false
.
Examples
returns '[red,green]'
Split('red,green,blue,orange', ',', 2)
Splits the paragraph at each space an unlimited number of times. Returns an array of the words in the paragraph.
Split(paragraph, ' ', -1, true)
StandardizeGuid
StandardizeGuid(inputGuid, format) -> Text
Function bundle: Core
Returns a standardized, formatted GUID string.
Parameters
- inputGuid: Text - The input GUID in any format to standardize.
- format: Text - A named format for the GUID.
Possible Values:digits
|digits-hyphen
|digits-hyphen-braces
|digits-hyphen-parentheses
Return value: Text
Examples
Converts a GUID to digits
format
StandardizeGuid('{4e6f776d-c298-4b4b-86a4-57103b4d0f4a}', 'digits')
// Returns a value of 4e6f776dc2984b4b86a457103b4d0f4a
Converts a GUID to digits-hyphen
format
StandardizeGuid('{4e6f776d-c298-4b4b-86a4-57103b4d0f4a}', 'digits-hyphen')
// Returns a value of 4e6f776d-c298-4b4b-86a4-57103b4d0f4a
Text
Text(value, format?) -> Text
Function bundle: Core
Converts any value into a text value. An optional format
parameter is provided to allow for formatting date and number data inputs. Returns null
if an equivalent text conversion cannot be determined.
Parameters
- value: Any - A value (i.e. date, number or other data type) to be converted to text. Starting at version 1.25, Polygon or Polyline inputs may return JSON containing curve objects when executed in ArcGIS Pro and ArcGIS Maps SDKs for Native Apps.
- format (Optional): Text - Special characters for formatting dates or numbers.
Possible values:0
: Digit#
: Digit, omitting leading/trailing zerosD
: Day of the month, not padded (1 - 31)DD
: Day of the month, padded (01 - 31)DDD
: Ordinal day of the year (1 - 365)d
: Day of the week (1 - 7)ddd
: Abbreviated day of the week (e.g. Mon)dddd
: Full day of the week (e.g. Monday)M
: Month number (1 - 12)MM
: Month number, padded (01 - 12)MMM
: Abbreviated month name (e.g. Jan)MMMM
: Full month name (e.g. January)Y
: Full yearYY
: Two-digit yearh
: Civilian hours, not padded (0 - 12)hh
: Civilian hours, padded (00 - 12)H
: Military hours, not padded (0 - 24)HH
: Military hours, padded (00 - 24)m
: Minutes, not padded (0 - 59)mm
: Minutes, padded (00 - 59)s
: Seconds, not padded (0 - 59)ss
: Seconds, padded (00 - 59)SSS
: Milliseconds, padded (000 - 999)A
: AM/PMZ
: Time zone offset in narrow hours +/- UTC (e.g.-7
or+11
)ZZ
: Time zone offset in hours +/- UTC (e.g.-07
or:00 +11
):00 ZZZ
: Time zone offset in compact hours +/- UTC (e.g.-0700
or+1100
)ZZZZ
: Abbreviated named time zone (e.g.EST
)ZZZZZ
: Named time zone (e.g.Eastern Standard Time
)
Return value: Text
Examples
Pad the number to the left of the decimal
Text(123, '0000') // '0123'
Restrict the number to the left of the decimal
Text(123, '00') // '23'
Group the number by thousands
Text(1234, '#,###') // '1,234'
Round the number to two decimal places
Text(12345678.123, '#,###.00') // '12,345,678.12'
Format number as currency
Text(1234.55, '$#,###.00') // '$1,234.55'
Round the number to two decimal places
Text(1.236, '#.00') // '1.24'
Maintain significant digits and group by thousands
Text(1234.5678, '#,##0.00#') // '1,234.568'
Format the number and format positive/negative - if there is a negative subpattern, it serves only to specify the negative prefix and suffix
Text(-2, 'Floor #;Basement #') // 'Basement 2'
Text(2, 'Floor #;Basement #') // 'Floor 2'
Multiply by 100 and format as percentage
Text(0.3, '#%') // '30%'
Format date and time at the moment. eg 'Tuesday, October 25, 2016 @ 08:43:11'
Text(Now(), 'dddd, MMMM D, Y @ h:m:s')
Formats the date and time with the timezone
Text(startDate, 'ddd, MMM D, Y h:mm:ss A ZZZZ')
// returns Thu, Sep 14, 2023 10:04:49 AM PDT
ToCharCode
ToCharCode(inputText, index?) -> Number
Function bundle: Core
Returns a number between 0 and 65535 representing the UTF-16 code unit at the given index. Invalid halves of surrogate pairs are automatically removed.
Parameters
- inputText: Text - The text from which to get a UTF-16 code unit value.
- index (Optional): Number - An integer with a value of at least 0 and no greater than the number of characters of
input
. By default, this value is 0.Text
Return value: Number
Examples
The following example returns 88, the Unicode value for X.
ToCharCode('XYZ')
// returns 88
The following example returns 89, the Unicode value for Y.
ToCharCode('XYZ', 1)
// returns 89
The following example returns 65535.
ToCharCode('\uFFFF\uFFFE')
// returns 65535
The following example returns 55356.
ToCharCode('🌉')
// returns 55356
The following example returns 57097.
ToCharCode('🌉', 1)
// returns 57097
ToCodePoint
ToCodePoint(inputText, position?) -> Number
Function bundle: Core
Returns a non-negative number representing the UTF-32 code point value of the input text. If indexed into the first half of a surrogate pair, the whole code point is returned. If indexed into the second half of the pair, this function returns the value of the second half. If a large code isn't a valid character, the function returns only the value of the half it indexes into.
Parameters
- inputText: Text - The text from which to get a UTF-32 code point value.
- position (Optional): Number - Position of a character in
input
from which to return the code point value. By default this value is 0.Text
Return value: Number
Examples
The following example returns 88, the Unicode value for X.
ToCodePoint('XYZ')
// returns 88
The following example returns 89, the Unicode value for Y.
ToCodePoint('XYZ', 1)
// returns 89
The following example returns 127753.
ToCodePoint('🌉')
// returns 127753
The following example returns 57097.
ToCodePoint('🌉', 1)
// returns 57097
ToHex
ToHex(value) -> Text
Function bundle: Core
Converts an integer to a hexidecimal representation.
Parameter
- value: Number - The value to be converted to a hexidecimal value.
Return value: Text
Examples
Returns "64"
.
ToHex(100)
Returns the hexidecimal representation for the color royal blue, "#4169
, from its RGB values
var r = ToHex(65); // returns "41"
var g = ToHex(105); // returns "69"
var b = ToHex(225); // returns "E1"
Concatenate("#",r,g,b)
// Returns "#4169E1"
Trim
Trim(inputText) -> Text
Function bundle: Core
Removes spaces from the beginning or end of an input text value.
Parameter
- inputText: Text - The text to be trimmed.
Return value: Text
Example
prints 'hello world'
Trim(' hello world')
Upper
Upper(inputText) -> Text
Function bundle: Core
Makes text upper case.
Parameter
- inputText: Text - The text value to be made uppercase.
Return value: Text
Example
prints 'HELLO'
Upper('Hello')
UrlEncode
UrlEncode(textOrDictionary) -> Text
Function bundle: Core
Encodes a URL by replacing each instance of certain characters by one, two, three, or four escape sequences representing the UTF-8 encoding of the character.
Parameter
- textOrDictionary: Text | Dictionary - The URL to be encoded.
Return value: Text
Example
Encodes the URL provided
var urlsource ='arcgis-survey123://?';
var params = {
itemID:'36ff9e8c13e042a58cfce4ad87f55d19',
center: '43.567,-117.380'
};
return urlsource + UrlEncode(params);
//arcgis-survey123://?center=43.567%2C-117.380&itemID=36ff9e8c13e042a58cfce4ad87f55d19