I have a string that contains a number in a Jsonnet variable. How do I convert it to an integer?
Jsonnet's standard library provides a: std.parseInt(str)
function that can parse a signed decimal integer from a given input string.
For example:
std.parseInt("123") // yields 123
std.parseInt("-456") // yields -456
Reference: http://jsonnet.org/docs/stdlib.html
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With