Text Functions
Functions for formatting text values. These are commonly used in the labeling and popup profiles.
Concatenate - Find - Left - Lower - Mid - Proper - Replace - Right - Split - Trim - Upper - UrlEncode
Concatenate
Concatenate( values, separator?, format? ) -> Text
Concatenates values together and returns a text value.
Name | Type | Description | ||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
values | Text[] | An array of text values to concatenate. | ||||||||||||||||||||||||||||||||||||||||||||||
separator | Text | optional 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 | Text | optional Formatting text for dates or numbers. This parameter is available in Arcade version 1.3 and later. See the list of possible values below.
|
Returns: Text
Example
prints 'red/blue/green'
Concatenate(['red', 'blue', 'green'], '/')
Find
Find( searchText, text, startpos? ) -> Number
Finds a string of characters within a text value. Wildcards are NOT supported. A returned value of -1
indicates no results were found.
Name | Type | Description |
---|---|---|
searchText | Text | The character string to search for. |
text | Text | The text to search. |
startpos | Number | optional The zero-based index of the location in the text to search from. |
Returns: Number
Example
prints 6
Find('380', 'Esri, 380 New York Street', 0)
Left
Left( value, charCount ) -> Text
Returns the specified number of characters from the beginning of a text value.
Name | Type | Description |
---|---|---|
value | Text | Array | Number | Boolean | The text from which to get characters. |
charCount | Number | The number of characters to get from the beginning of the text. |
Returns: Text
Example
prints 'the'
Left('the quick brown fox', 3)
Lower
Lower( value ) -> Text
Makes a text value lower case.
Name | Type | Description |
---|---|---|
value | Text | The text to be made lowercase. |
Returns: Text
Example
prints 'hello'
Lower('HELLO')
Mid
Mid( value, startpos, charCount ) -> Text
Gets a number of characters from the middle of a text value.
Name | Type | Description |
---|---|---|
value | Text | Array | Number | Boolean | The text from which to get characters. |
startpos | Number | The starting position from which to get the text. 0 is the first position. |
charCount | Number | The number of characters to extract. |
Returns: Text
Example
prints 'quick'
Mid('the quick brown fox', 4, 5)
Proper
Proper( value, applyTo? ) -> Text
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.
Name | Type | Description |
---|---|---|
value | Text | The text to convert to title case. |
applyTo | Text | optional 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 or firstword . |
Returns: Text
Example
prints 'The Quick Brown Fox'
Proper('the quick brown fox', 'everyword')
Replace
Replace( value, searchText, replacementText, allOccurrences? ) -> Text
Replaces a string within a text value or an element within an array. Defaults to replacing all occurrences.
Name | Type | Description |
---|---|---|
value | Text | Array | Number | Boolean | The value in which to make replacements. |
searchText | Text | The text to search for. |
replacementText | Text | The replacement text. |
allOccurrences | Boolean | optional Indicates if all occurrences of the searchText should be replaced in the text. Defaults to true . |
Returns: Text
Example
prints 'the quick red fox'
Replace('the quick brown fox', 'brown', 'red')
Right
Right( value, charCount ) -> Text
Returns the specified number of characters from the end of a text value.
Name | Type | Description |
---|---|---|
value | Text | Array | Number | Boolean | The text from which to get characters. |
charCount | Number | The number of characters to get from the end of the text value. |
Returns: Text
Example
prints 'fox'
Right('the quick brown fox', 3)
Split
Split( value, separator, limit?, removeEmpty? ) -> Text[]
Splits a text value into an array.
Name | Type | Description |
---|---|---|
value | Text | The text value to be split. |
separator | Text | The separator used to split the text. |
limit | Number | optional An integer that specifies the number of splits. The default is -1 , which indicates an unlimited number of splits. |
removeEmpty | Boolean | optional Indicates whether to remove empty values. By default this is false . |
Returns: Text[]
Example
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)
Trim
Trim( value ) -> Text
Removes spaces from the beginning or end of an input text value.
Name | Type | Description |
---|---|---|
value | Text | The text to be trimmed. |
Returns: Text
Example
prints 'hello world'
Trim(' hello world')
Upper
Upper( value ) -> Text
Makes text upper case.
Name | Type | Description |
---|---|---|
value | Text | The text value to be made uppercase. |
Returns: Text
Example
prints 'HELLO'
Upper('Hello')
UrlEncode
UrlEncode( url ) -> Text
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.
Name | Type | Description |
---|---|---|
url | Text | Dictionary | The URL to be encoded. |
Returns: 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
Feedback on this topic?