Skip to content

Commit 9413237

Browse files
authored
Merge pull request #99137 from ecfan/formatNumber
Add missing formatNumber function
2 parents aef8ce2 + 768e8a6 commit 9413237

File tree

1 file changed

+55
-0
lines changed

1 file changed

+55
-0
lines changed

articles/logic-apps/workflow-definition-language-functions-reference.md

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ String functions work only on strings.
104104
| --------------- | ---- |
105105
| [concat](../logic-apps/workflow-definition-language-functions-reference.md#concat) | Combine two or more strings, and return the combined string. |
106106
| [endsWith](../logic-apps/workflow-definition-language-functions-reference.md#endswith) | Check whether a string ends with the specified substring. |
107+
| [formatNumber](../logic-apps/workflow-definition-language-functions-reference.md#formatNumber) | Return a number as a string based on the specified format |
107108
| [guid](../logic-apps/workflow-definition-language-functions-reference.md#guid) | Generate a globally unique identifier (GUID) as a string. |
108109
| [indexOf](../logic-apps/workflow-definition-language-functions-reference.md#indexof) | Return the starting position for a substring. |
109110
| [lastIndexOf](../logic-apps/workflow-definition-language-functions-reference.md#lastindexof) | Return the starting position for the last occurrence of a substring. |
@@ -2084,6 +2085,60 @@ formDataValue('Send_an_email', 'Subject')
20842085

20852086
And returns the subject text as a string, for example: `"Hello world"`
20862087

2088+
<a name="formatNumber"></a>
2089+
2090+
### formatNumber
2091+
2092+
Return a number as a string that's based on the specified format.
2093+
2094+
```text
2095+
formatNumber(<number>, <format>, <locale>?)
2096+
```
2097+
2098+
| Parameter | Required | Type | Description |
2099+
| --------- | -------- | ---- | ----------- |
2100+
| <*number*> | Yes | Integer or Double | The value that you want to format. |
2101+
| <*format*> | Yes | String | A composite format string that specifies the format that you want to use. For the supported numeric format strings, see [Standard numeric format strings](https://docs.microsoft.com/dotnet/standard/base-types/standard-numeric-format-strings), which are supported by `number.ToString(<format>, <locale>)`. |
2102+
| <*locale*> | No | String | The locale to use as supported by `number.ToString(<format>, <locale>)`. If not specified, the default value is `en-us`. |
2103+
|||||
2104+
2105+
| Return value | Type | Description |
2106+
| ------------ | ---- | ----------- |
2107+
| <*formatted-number*> | String | The specified number as a string in the format that you specified. You can cast this return value to an `int` or `float`. |
2108+
||||
2109+
2110+
*Example 1*
2111+
2112+
Suppose that you want to format the number `1234567890`. This example formats that number as the string "1,234,567,890.00".
2113+
2114+
```
2115+
formatNumber(1234567890, "{0:0,0.00}", "en-us")
2116+
```
2117+
2118+
*Example 2"
2119+
2120+
Suppose that you want to format the number `1234567890`. This example formats the number to the string "1.234.567.890,00".
2121+
2122+
```
2123+
formatNumber(1234567890, "{0:0,0.00}", "is-is")
2124+
```
2125+
2126+
*Example 3*
2127+
2128+
Suppose that you want to format the number `17.35`. This example formats the number to the string "$17.35".
2129+
2130+
```
2131+
formatNumber(17.36, "{0:C2}")
2132+
```
2133+
2134+
*Example 4*
2135+
2136+
Suppose that you want to format the number `17.35`. This example formats the number to the string "17,35 kr".
2137+
2138+
```
2139+
formatNumber(17.36, "{0:C2}", "is-is")
2140+
```
2141+
20872142
<a name="getFutureTime"></a>
20882143

20892144
### getFutureTime

0 commit comments

Comments
 (0)