Skip to content

Commit 9faf827

Browse files
committed
Update ternary operators
1 parent 46cfc2b commit 9faf827

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

docs/declarative-customization/column-formatting.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1408,6 +1408,19 @@ Operators specify the type of operation to perform. The following operators are
14081408

14091409
The substring() method returns the part of the string between the start and end indexes, or to the end of the string.
14101410

1411+
- **replace**: searches a string for a specified value and returns a new string where the specified value is replaced. Only the first instance of the value will be replaced.
1412+
- `"txtContent":"=replace('Hello world', 'world', 'everyone')"` results in _Hello everyone_
1413+
1414+
- **padStart**: pads the current string with another string until the resulting string reaches the given length. The padding is applied from the start of the current string.
1415+
- `"txtContent":"=padStart('DogFood', 10, 'A')"` results in _AAADogFood_
1416+
- `"txtContent":"=padStart('DogFood', 10, 'AB')"` results in _ABADogFood_
1417+
- `"txtContent":"=padStart('DogFood', 5, 'A')"` results in _DogFood_
1418+
1419+
- **padEnd**: pads the current string with a given string until the resulting string reaches the given length. The padding is applied from the end of the current string.
1420+
- `"txtContent":"=padEnd('DogFood', 10, 'A')"` results in _DogFoodAAA_
1421+
- `"txtContent":"=padEnd('DogFood', 10, 'AB')"` results in _ABADogFoodABA_
1422+
- `"txtContent":"=padEnd('DogFood', 5, 'A')"` results in _DogFood_
1423+
14111424
**Conditional operator** - The conditional operator is:
14121425

14131426
- **?**: Conditional operations written in Abstract Tree Syntax use `?` as the operator. This is to achieve an expression equivalent to a ? b : c, where if the expression a evaluates to true, then the result is b, else the result is c. For Excel style expressions you write these with an `if` statement. Regardless, there are 3 operands. The first is the condition to evaluate. The second is the result when the condition is true. The third is the result when the condition is false.

0 commit comments

Comments
 (0)