Selaa lähdekoodia

cookbooks/devel/transformations: section for {num.name} transformation

Daniel-Constantin Mierla 1 kuukausi sitten
vanhempi
commit
56eab8a1f1
1 muutettua tiedostoa jossa 24 lisäystä ja 0 poistoa
  1. 24 0
      docs/cookbooks/devel/transformations.md

+ 24 - 0
docs/cookbooks/devel/transformations.md

@@ -1034,3 +1034,27 @@ the value is int, then it is preserved as it is.
 $var(x) = '"name" <sip:[email protected]>';
 $(var(x){val.jsonqe}) => "\"name\" <sip:[email protected]>"
 ```
+
+## Number Transformations
+
+Exported by **pv** module.
+
+### {num.fdigit}
+
+Return the first digit of the number. In case of a string or $null value, `0` is
+returned.
+
+``` c
+$var(x) = 1234;
+# $(var(x){num.fdigit}) -> 1
+```
+
+### {num.ldigit}
+
+Return the last digit of the number. In case of a string or $null value, `0` is
+returned.
+
+``` c
+$var(x) = 1234;
+# $(var(x){num.ldigit}) -> 4
+```