diff options
author | Minh Nguyễn <mxn@1ec5.org> | 2018-04-19 15:03:21 -0700 |
---|---|---|
committer | Minh Nguyễn <mxn@1ec5.org> | 2018-04-19 15:03:21 -0700 |
commit | 512e598802e748deb516b2303a16905be36730b7 (patch) | |
tree | bf38de2632ff827738f8f809182ac80103fe04ad | |
parent | eaf3de73cc9e238d3a40cbf50233d28911df213a (diff) | |
download | qtlocation-mapboxgl-512e598802e748deb516b2303a16905be36730b7.tar.gz |
[ios, macos] Reorganized custom function documentation
Reorganized the custom function documentation as a series of sections with headers and definition lists instead of a monolithic table. Copyedited various sections for accuracy. Linked references to custom functions. Added format string examples for all custom functions.
-rw-r--r-- | platform/darwin/docs/guides/Predicates and Expressions.md | 629 |
1 files changed, 411 insertions, 218 deletions
diff --git a/platform/darwin/docs/guides/Predicates and Expressions.md b/platform/darwin/docs/guides/Predicates and Expressions.md index fff0992454..89e4983b9c 100644 --- a/platform/darwin/docs/guides/Predicates and Expressions.md +++ b/platform/darwin/docs/guides/Predicates and Expressions.md @@ -136,7 +136,7 @@ NSExpression(forFunction: "lowercase:", arguments: [NSExpression(forKeyPath: "ISO 3166-1:2006")]) ``` -### Predefined functions +### Functions Of the [functions predefined by the `+[NSExpression expressionForFunction:arguments:]` method](https://developer.apple.com/documentation/foundation/nsexpression/1413747-init#discussion), @@ -169,7 +169,10 @@ Initializer parameter | Format string syntax `length:` | `length('Wapakoneta')` `castObject:toType:` | `CAST(ele, 'NSString')`<br>`CAST(ele, 'NSNumber')` -The following predefined functions are not supported: +A number of [Mapbox-specific functions](#mapbox-specific-funcions) are also +available. + +The following predefined functions are **not** supported: Initializer parameter | Format string syntax ----------------------|--------------------- @@ -187,228 +190,13 @@ Initializer parameter | Format string syntax `onesComplement:` | `onesComplement(255)` `distanceToLocation:fromLocation:` | `distanceToLocation:fromLocation:(there, here)` -### Mapbox-specific functions - -For compatibility with the Mapbox Style Specification, the following functions -are defined by this SDK. When setting a style layer property, you can call these -functions just like the predefined functions above, using either the -`+[NSExpression expressionForFunction:arguments:]` method or a convenient format -string syntax: - -Initializer parameter | Format string syntax | Description -----------------------|----------------------|------------ -`mgl_does:have:` | `mgl_does:have:(SELF, 'key')` or `mgl_does:have:(%@, 'key')` | Returns a Boolean value indicating whether the dictionary has a value for the key or whether the evaluated object (`SELF`) has a value for the feature attribute. Compared to the `mgl_has:` custom function, that function’s target is instead passed in as the first argument to this function. Both functions are equivalent to the syntax `key != NIL` or `%@[key] != NIL` but can be used outside of a predicate. -`mgl_interpolate:withCurveType:parameters:stops:` | `mgl_interpolate:withCurveType:parameters:stops:(x, 'linear', nil, %@)` | Produces continuous, smooth results by interpolating between pairs of input and output values (“stops”). Compared to the `mgl_interpolateWithCurveType:parameters:stops:` custom function, the input expression (that function’s target) is instead passed in as the first argument to this function. -`mgl_step:from:stops:` | `mgl_step:from:stops:(x, 11, %@)` | Produces discrete, stepped results by evaluating a piecewise-constant function defined by pairs of input and output values ("stops"). Compared to the `mgl_stepWithMinimum:stops:` custom function, the input expression (that function’s target) is instead passed in as the first argument to this function. -`mgl_join:` | `mgl_join({'Old', 'MacDonald'})` | Returns the result of concatenating together all the elements of an array in order. Compared to the `stringByAppendingString:` custom function, this function takes only one argument, which is an aggregate expression containing the strings to concatenate. -`mgl_round:` | `mgl_round(1.5)` | Returns the number rounded to the nearest integer. If the number is halfway between two integers, this function rounds it away from zero. -`mgl_coalesce:` | `mgl_coalesce({x, y, z})` | Returns the first non-`nil` value from an array of expressions. -`MGL_LET` | `MGL_LET('age', uppercase('old'), 'name', uppercase('MacDonald'), mgl_join({$age, $name}))` | Any number of variable names interspersed with their assigned `NSExpression` values, followed by an `NSExpression` that may contain references to those variables. Compared to the `mgl_expressionWithContext:` custom function, this function takes the variable names and values inline before the expression that contains references to those variables. -`MGL_MATCH` | `MGL_MATCH(x, 0, 'zero match', 1, 'one match', 'two match', 'default')` | Evaluates the first expression and returns the value that matches the initial condition. After the first expression condition a pair of matching/return value should be added and a default value. -`MGL_IF` | `MGL_IF(1 = 2, YES, 2 = 2, YES, NO)` | Returns the first value that meets the condition otherwise a default value. The expression conditions should be added in pairs of conditional/return value. Unlike `+[NSExpression expressionForConditional:trueExpression:falseExpression:]` or the `TERNARY()` syntax, this function can accept multiple “if else” conditions and is supported on iOS 8._x_ and macOS 10.10._x_; however, each conditional passed into this function must be wrapped in a constant expression. - -The following custom functions are also available with the -`+[NSExpression expressionForFunction:selectorName:arguments:]` method or the -`FUNCTION()` format string syntax: - -<table> -<thead> -<tr><th>Selector name</th><th>Target</th><th>Arguments</th><th>Returns</th></tr> -</thead> -<tbody> -<tr> - <td><code>boolValue</code></td> - <td> - An <code>NSExpression</code> that evaluates to a number or string. - </td> - <td></td> - <td> - A Boolean representation of the target: <code>FALSE</code> when then input is an - empty string, 0, <code>FALSE</code>, <code>NIL</code>, or <code>NaN</code>, otherwise <code>TRUE</code>. - </td> -</tr> -<tr> - <td><code>mgl_has:</code></td> - <td> - An <code>NSExpression</code> that evaluates to an <code>NSDictionary</code> or the evaluated object (<code>SELF</code>). - </td> - <td> - An <code>NSExpression</code> that evaluates to an <code>NSString</code> representing the key to look up in the dictionary or the feature attribute to look up in the evaluated object (see <code>MGLFeature.attributes</code>). - </td> - <td> - <code>true</code> if the dictionary has a value for the key or if the evaluated object has a value for the feature attribute. - </td> -<tr> - <td><code>mgl_expressionWithContext:</code></td> - <td> - An <code>NSExpression</code> that may contain references to the variables defined in - the context dictionary. - </td> - <td> - An <code>NSDictionary</code> with <code>NSString</code>s as keys and <code>NSExpression</code>s as values. - Each key is a variable name and each value is the variable’s value within - the target expression. - </td> - <td> - The target expression with variable subexpressions replaced with the - values defined in the context dictionary. - </td> -</tr> -<tr> - <td><code>mgl_interpolateWithCurveType:parameters:stops:</code></td> - <td> - An <code>NSExpression</code> that evaluates to a number and contains a variable or - key path expression. - </td> - <td> - The first argument is one of the following strings denoting curve types: - <code>linear</code>, <code>exponential</code>, or <code>cubic-bezier</code>. - - The second argument is an expression providing parameters for the curve: - - <ul> - <li>If the curve type is <code>linear</code>, the argument is <code>NIL</code>.</li> - <li> - If the curve type is <code>exponential</code>, the argument is an expression - that evaluates to a number, specifying the base of the exponential - interpolation. - </li> - <li> - If the curve type is <code>cubic-bezier</code>, the argument is an array or - aggregate expression containing four expressions, each evaluating to - a number. The four numbers are control points for the cubic Bézier - curve. - </li> - </ul> - - The third argument is an <code>NSDictionary</code> object representing the - interpolation’s stops, with numeric zoom levels as keys and expressions as - values. - </td> - <td> - A value interpolated along the continuous mathematical function defined by - the arguments, with the target as the input to the function. - </td> -</tr> -<tr> - <td> - <code>mgl_numberWithFallbackValues:</code>, - <code>doubleValue</code>, - <code>floatValue</code>, - <code>decimalValue</code> - </td> - <td> - An <code>NSExpression</code> that evaluates to a Boolean value, number, or string. - </td> - <td> - Zero or more <code>NSExpression</code>s, each evaluating to a Boolean value or - string. - </td> - <td> - A numeric representation of the target: - <ul> - <li>If the target is <code>NIL</code> or <code>FALSE</code>, the result is 0.</li> - <li>If the target is true, the result is 1.</li> - <li> - If the target is a string, it is converted to a number as specified - by the - “<a href="https://tc39.github.io/ecma262/#sec-tonumber-applied-to-the-string-type">ToNumber Applied to the String Type</a>” - algorithm of the ECMAScript Language Specification. - </li> - <li> - If multiple values are provided, each one is evaluated in order - until the first successful conversion is obtained. - </li> - </ul> - </td> -</tr> -<tr> - <td><code>mgl_stepWithMinimum:stops:</code></td> - <td> - An <code>NSExpression</code> that evaluates to a number and contains a variable or - key path expression. - </td> - <td> - The first argument is an expression that evaluates to a number, specifying - the minimum value in case the target is less than any of the stops in the - second argument. - - The second argument is an <code>NSDictionary</code> object representing the - interpolation’s stops, with numeric zoom levels as keys and expressions as - values. - </td> - <td> - The output value of the stop whose key is just less than the evaluated - target, or the minimum value if the target is less than the least of the - stops’ keys. - </td> -</tr> -<tr> - <td><code>stringByAppendingString:</code></td> - <td> - An <code>NSExpression</code> that evaluates to a string. - </td> - <td> - One or more <code>NSExpression</code>s, each evaluating to a string. - </td> - <td> - The target string with each of the argument strings appended in order. - </td> -</tr> -<tr> - <td><code>stringValue</code></td> - <td> - An <code>NSExpression</code> that evaluates to a Boolean value, number, or string. - </td> - <td></td> - <td> - A string representation of the target: - <ul> - <li>If the target is <code>NIL</code>, the result is the string <code>null</code>.</li> - <li> - If the target is a Boolean value, the result is the string <code>true</code> or - <code>false</code>. - </li> - <li> - If the target is a number, it is converted to a string as specified - by the - “<a href="https://tc39.github.io/ecma262/#sec-tostring-applied-to-the-number-type">NumberToString</a>” - algorithm of the ECMAScript Language Specification. - </li> - <li> - If the target is a color, it is converted to a string of the form - <code>rgba(r,g,b,a)</code>, where <var>r</var>, <var>g</var>, and <var>b</var> - are numerals ranging from 0 to 255 and <var>a</var> ranges from 0 to - 1. - </li> - <li> - Otherwise, the target is converted to a string in the format - specified by the - <a href="https://tc39.github.io/ecma262/#sec-json.stringify"><code>JSON.stringify()</code></a> - function of the ECMAScript Language Specification. - </li> - </ul> - </td> -</tr> -</tbody> -</table> - -Some of these functions are defined as methods on their respective target -classes, but you should not call them directly outside the context of an -expression, because the result may differ from the evaluated expression’s result -or may result in undefined behavior. - -The Mapbox Style Specification defines some operators for which no custom -function is available. To use these operators in an `NSExpression`, call the -`MGL_FUNCTION()` function with the same arguments that the operator expects. - ### Conditionals Conditionals are supported via the built-in `+[NSExpression expressionForConditional:trueExpression:falseExpression:]` method and `TERNARY()` operator. If you need to express multiple cases (“else-if”), you can either nest a conditional within a conditional or use the -`MGL_IF()` or `MGL_MATCH()` function. +[`MGL_IF()`](#code-mgl_if-code) or [`MGL_MATCH()`](#code-mgl_match-code) function. ### Aggregates @@ -492,3 +280,408 @@ of a [Mapbox-specific function](#mapbox-specific-functions) that takes an ```swift NSExpression(format: "MGL_LET(floorCount, 2, $floorCount + 1)") ``` + +## Mapbox-specific functions + +For compatibility with the Mapbox Style Specification, the following functions +are defined by this SDK. When setting a style layer property, you can call these +functions just like the predefined functions above, using either the +`+[NSExpression expressionForFunction:arguments:]` method or a convenient format +string syntax: + +### `mgl_does:have:` + +<dl> +<dt>Selector:</dt> +<dd>`mgl_does:have:`</dd> +<dt>Format string syntax:</dt> +<dd><code>mgl_does:have:(SELF, 'key')</code> or <code>mgl_does:have:(%@, 'key')</code></dd> +</dl> + +Returns a Boolean value indicating whether the dictionary has a value for the +key or whether the evaluated object (`SELF`) has a value for the feature +attribute. Compared to the [`mgl_has:`](#code-mgl_has-code) custom function, +that function’s target is instead passed in as the first argument to this +function. Both functions are equivalent to the syntax `key != NIL` or +`%@[key] != NIL` but can be used outside of a predicate. + +### `mgl_interpolate:withCurveType:parameters:stops:` + +<dl> +<dt>Selector:</dt> +<dd><code>mgl_interpolate:withCurveType:parameters:stops:</code></dd> +<dt>Format string syntax:</dt> +<dd><code>mgl_interpolate:withCurveType:parameters:stops:(x, 'linear', nil, %@)</code></dd> +</dl> + +Produces continuous, smooth results by interpolating between pairs of input and +output values (“stops”). Compared to the +[`mgl_interpolateWithCurveType:parameters:stops:`](#code-mgl_interpolatewithcurvetype-parameters-stops-code) +custom function, the input expression (that function’s target) is instead passed +in as the first argument to this function. + +### `mgl_step:from:stops:` + +<dl> +<dt>Selector:</dt> +<dd><code>mgl_step:from:stops:</code></dd> +<dt>Format string syntax:</dt> +<dd><code>mgl_step:from:stops:(x, 11, %@)</code></dd> +</dl> + +Produces discrete, stepped results by evaluating a piecewise-constant function +defined by pairs of input and output values ("stops"). Compared to the +[`mgl_stepWithMinimum:stops:`](#code-mgl_stepwithminimum-stops-code) custom +function, the input expression (that function’s target) is instead passed in as +the first argument to this function. + +### `mgl_join:` + +<dl> +<dt>Selector:</dt> +<dd><code>mgl_join:</code></dd> +<dt>Format string syntax:</dt> +<dd><code>mgl_join({'Old', 'MacDonald'})</code></dd> +</dl> + +Returns the result of concatenating together all the elements of an array in +order. Compared to the +[`stringByAppendingString:`](#code-stringbyappendingstring-code) custom +function, this function takes only one argument, which is an aggregate +expression containing the strings to concatenate. + +### `mgl_round:` + +<dl> +<dt>Selector:</dt> +<dd><code>mgl_round:</code></dd> +<dt>Format string syntax:</dt> +<dd><code>mgl_round(1.5)</code></dd> +</dl> + +Returns the number rounded to the nearest integer. If the number is halfway +between two integers, this function rounds it away from zero. + +### `mgl_coalesce:` + +<dl> +<dt>Selector:</dt> +<dd><code>mgl_coalesce:</code></dd> +<dt>Format string syntax:</dt> +<dd><code>mgl_coalesce({x, y, z})</code></dd> +</dl> + +Returns the first non-`nil` value from an array of expressions. + +### `MGL_LET` + +<dl> +<dt>Selector:</dt> +<dd><code>MGL_LET:</code></dd> +<dt>Format string syntax:</dt> +<dd><code>MGL_LET('age', uppercase('old'), 'name', uppercase('MacDonald'), mgl_join({$age, $name}))</code></dd> +<dt>Arguments:</dt> +<dd> + Any number of variable names interspersed with their assigned + <code>NSExpression</code> values, followed by an <code>NSExpression</code> + that may contain references to those variables. +</dd> +</dl> + +Returns the result of evaluating an expression with the given variable values. +Compared to the +[`mgl_expressionWithContext:`](#code-mgl_expressionwithcontext-code) custom +function, this function takes the variable names and values inline before the +expression that contains references to those variables. + +### `MGL_MATCH` + +<dl> +<dt>Selector:</dt> +<dd><code>MGL_MATCH:</code></dd> +<dt>Format string syntax:</dt> +<dd><code>`MGL_MATCH(x, 0, 'zero match', 1, 'one match', 'two match', 'default')`</code></dd> +<dt>Arguments:</dt> +<dd> + An input expression, then any number of argument pairs, followed by a default + expression. Each argument pair consists of a constant value followed by an + expression to produce as a result of matching that constant value. +</dd> +</dl> + +Returns the result of matching the input expression against the given constant +values. + +### `MGL_IF` + +<dl> +<dt>Selector:</dt> +<dd><code>MGL_IF:</code></dd> +<dt>Format string syntax:</dt> +<dd><code>`MGL_IF(1 = 2, YES, 2 = 2, YES, NO)`</code></dd> +<dt>Arguments:</dt> +<dd> + Alternating <code>NSPredicate</code> conditionals and resulting expressions, + followed by a default expression. +</dd> +</dl> + +Returns the first expression that meets the condition; otherwise, the default +value. Unlike +`+[NSExpression expressionForConditional:trueExpression:falseExpression:]` or +the `TERNARY()` syntax, this function can accept multiple “if else” conditions +and is supported on iOS 8._x_ and macOS 10.10._x_; however, each conditional +passed into this function must be wrapped in a constant expression. + +### `MGL_FUNCTION` + +<dl> +<dt>Selector:</dt> +<dd><code>MGL_FUNCTION:</code></dd> +<dt>Format string syntax:</dt> +<dd><code>`MGL_FUNCTION('typeof', mystery)`</code></dd> +<dt>Arguments:</dt> +<dd> + Any arguments required by the expression operator, as defined in the + [Mapbox Style Specification](https://www.mapbox.com/mapbox-gl-js/style-spec/#expressions). +</dd> +</dl> + +## Custom functions + +The following custom functions are also available with the +`+[NSExpression expressionForFunction:selectorName:arguments:]` method or the +`FUNCTION()` format string syntax. + +Some of these functions are defined as methods on their respective target +classes, but you should not call them directly outside the context of an +expression, because the result may differ from the evaluated expression’s result +or may result in undefined behavior. + +The Mapbox Style Specification defines some operators for which no custom +function is available. To use these operators in an `NSExpression`, call the +[`MGL_FUNCTION()`](#code-mgl_function-code) function with the same arguments +that the operator expects. + +### `boolValue` + +<dl> +<dt>Selector:</dt> +<dd><code>boolValue</code></dd> +<dt>Format string syntax:</dt> +<dd><code>`FUNCTION(1, 'boolValue')`</code></dd> +<dt>Target:</dt> +<dd> + An <code>NSExpression</code> that evaluates to a number or string. +</dd> +<dt>Arguments:</dt> +<dd>None.</dd> +</dl> + +A Boolean representation of the target: <code>FALSE</code> when then input is an +empty string, 0, <code>FALSE</code>, <code>NIL</code>, or <code>NaN</code>, +otherwise <code>TRUE</code>. + +### `mgl_has:` + +<dl> +<dt>Selector:</dt> +<dd><code>mgl_has:</code></dd> +<dt>Format string syntax:</dt> +<dd><code>`FUNCTION($featureProperties, 'mgl_has:', '🧀🍔')`</code></dd> +<dt>Target:</dt> +<dd> + An <code>NSExpression</code> that evaluates to an <code>NSDictionary</code> + or the evaluated object (<code>SELF</code>). +</dd> +<dt>Arguments:</dt> +<dd> + An <code>NSExpression</code> that evaluates to an <code>NSString</code> + representing the key to look up in the dictionary or the feature attribute to + look up in the evaluated object (see <code>MGLFeature.attributes</code>). +</dd> +</dl> + +<code>true</code> if the dictionary has a value for the key or if the evaluated +object has a value for the feature attribute. + +### `mgl_expressionWithContext:` + +<dl> +<dt>Selector:</dt> +<dd><code>mgl_expressionWithContext:</code></dd> +<dt>Format string syntax:</dt> +<dd> + <code>`FUNCTION($ios + $macos, 'mgl_expressionWithContext:', %@)`</code> with + a dictionary containing `ios` and `macos` keys +</dd> +<dt>Target:</dt> +<dd> + An <code>NSExpression</code> that may contain references to the variables + defined in the context dictionary. +</dd> +<dt>Arguments:</dt> +<dd> + An <code>NSDictionary</code> with <code>NSString</code>s as keys and + <code>NSExpression</code>s as values. Each key is a variable name and each + value is the variable’s value within the target expression. +</dd> +</dl> + +The target expression with variable subexpressions replaced with the values +defined in the context dictionary. + +### `mgl_interpolateWithCurveType:parameters:stops:` + +<dl> +<dt>Selector:</dt> +<dd><code>mgl_interpolateWithCurveType:parameters:stops:</code></dd> +<dt>Format string syntax:</dt> +<dd> + <code>`FUNCTION($zoomLevel, 'mgl_interpolateWithCurveType:parameters:stops:', 'linear', NIL, %@)`</code> + with a dictionary containing zoom levels as keys +</dd> +<dt>Target:</dt> +<dd> + An <code>NSExpression</code> that evaluates to a number and contains a + variable or key path expression. +</dd> +<dt>Arguments:</dt> +<dd> + The first argument is one of the following strings denoting curve types: + <code>linear</code>, <code>exponential</code>, or <code>cubic-bezier</code>. + + The second argument is an expression providing parameters for the curve: + + <ul> + <li>If the curve type is <code>linear</code>, the argument is <code>NIL</code>.</li> + <li> + If the curve type is <code>exponential</code>, the argument is an + expression that evaluates to a number, specifying the base of the + exponential interpolation. + </li> + <li> + If the curve type is <code>cubic-bezier</code>, the argument is an + array or aggregate expression containing four expressions, each + evaluating to a number. The four numbers are control points for the + cubic Bézier curve. + </li> + </ul> + + The third argument is an <code>NSDictionary</code> object representing the + interpolation’s stops, with numeric zoom levels as keys and expressions as + values. +</dd> +</dl> + +A value interpolated along the continuous mathematical function defined by the +arguments, with the target as the input to the function. + +### `mgl_numberWithFallbackValues:` + +<dl> +<dt>Selector:</dt> +<dd> + <code>mgl_numberWithFallbackValues:</code>, + <code>doubleValue</code>, + <code>floatValue</code>, or + <code>decimalValue</code> +</dd> +<dt>Format string syntax:</dt> +<dd><code>`FUNCTION(ele, 'mgl_numberWithFallbackValues:', 0)`</code></dd> +<dt>Target:</dt> +<dd> + An <code>NSExpression</code> that evaluates to a Boolean value, number, or + string. +</dd> +<dt>Arguments:</dt> +<dd> + Zero or more <code>NSExpression</code>s, each evaluating to a Boolean value + or string. +</dd> +</dl> + +A numeric representation of the target: + +* If the target is <code>NIL</code> or <code>FALSE</code>, the result is 0. +* If the target is true, the result is 1. + * If the target is a string, it is converted to a number as specified by the + “[ToNumber Applied to the String Type](https://tc39.github.io/ecma262/#sec-tonumber-applied-to-the-string-type)” + algorithm of the ECMAScript Language Specification. + * If multiple values are provided, each one is evaluated in order until the + first successful conversion is obtained. + +### `mgl_stepWithMinimum:stops:` + +<dl> +<dt>Selector:</dt> +<dd><code>mgl_stepWithMinimum:stops:</code></dd> +<dt>Format string syntax:</dt> +<dd> + <code>`FUNCTION($zoomLevel, 'mgl_stepWithMinimum:stops:', 0, %@)`</code> with + a dictionary with zoom levels as keys +</dd> +<dt>Target:</dt> +<dd> + An <code>NSExpression</code> that evaluates to a number and contains a + variable or key path expression. +</dd> +<dt>Arguments:</dt> +<dd> + The first argument is an expression that evaluates to a number, specifying + the minimum value in case the target is less than any of the stops in the + second argument. + + The second argument is an <code>NSDictionary</code> object representing the + interpolation’s stops, with numeric zoom levels as keys and expressions as + values. +</dd> +</dl> + +The output value of the stop whose key is just less than the evaluated target, +or the minimum value if the target is less than the least of the stops’ keys. + +### `stringByAppendingString:` + +<dl> +<dt>Selector:</dt> +<dd><code>stringByAppendingString:</code></dd> +<dt>Format string syntax:</dt> +<dd><code>`FUNCTION('Old', 'stringByAppendingString:', 'MacDonald')`</code></dd> +<dt>Target:</dt> +<dd>An <code>NSExpression</code> that evaluates to a string.</dd> +<dt>Arguments:</dt> +<dd>One or more <code>NSExpression</code>s, each evaluating to a string.</dd> +</dl> + +The target string with each of the argument strings appended in order. + +### `stringValue` + +<dl> +<dt>Selector:</dt> +<dd><code>stringValue</code></dd> +<dt>Format string syntax:</dt> +<dd><code>`FUNCTION(ele, 'stringValue')`</code></dd> +<dt>Target:</dt> +<dd> + An <code>NSExpression</code> that evaluates to a Boolean value, number, or + string. +</dd> +<dt>Arguments:</dt> +<dd>None.</dd> +</dl> + +A string representation of the target: + +* If the target is <code>NIL</code>, the result is the empty string. +* If the target is a Boolean value, the result is the string `true` or `false`. +* If the target is a number, it is converted to a string as specified by the + “[NumberToString](https://tc39.github.io/ecma262/#sec-tostring-applied-to-the-number-type)” + algorithm of the ECMAScript Language Specification. +* If the target is a color, it is converted to a string of the form + `rgba(r,g,b,a)`, where <var>r</var>, <var>g</var>, and <var>b</var> are + numerals ranging from 0 to 255 and <var>a</var> ranges from 0 to 1. +* Otherwise, the target is converted to a string in the format specified by the + [`JSON.stringify()`](https://tc39.github.io/ecma262/#sec-json.stringify) + function of the ECMAScript Language Specification. |