How to convert Int to Hex String in Kotlin?

You can still use the Java conversion by calling the static function on java.lang.Integer: val hexString = java.lang.Integer.toHexString(i) And, starting with Kotlin 1.1, there is a function in the Kotlin standard library that does the conversion, too: fun Int.toString(radix: Int): String Returns a string representation of this Int value in the specified radix. Note, however, … Read more

Formatting money in twig templates

The number_format filter has been included in the Twig core since the end of December 2011. The relevant commit is here. Usage: number_format(decimals, decimalSeparator, thousandSeparator) {{ total|number_format(2) }} {{ total|number_format(0, ‘.’) }} {{ total|number_format(2, ‘.’, ‘,’) }} Read more about it in the docs

The maximum value for an int type in Go

https://groups.google.com/group/golang-nuts/msg/71c307e4d73024ce?pli=1 The germane part: Since integer types use two’s complement arithmetic, you can infer the min/max constant values for int and uint. For example, const MaxUint = ^uint(0) const MinUint = 0 const MaxInt = int(MaxUint >> 1) const MinInt = -MaxInt – 1 As per @CarelZA’s comment: uint8 : 0 to 255 uint16 : … Read more