You are currently viewing String formatting library for Kotlin (or Java) like in fmt/rust/python

String formatting library for Kotlin (or Java) like in fmt/rust/python

I’m trying to find a string formatting library for Kotlin, or Java, that uses similar specifiers like it’s used in C++, Python or Rust. What I mean by that is shown on these examples:

// C++ std::cout << fmt::format("Hello 0x{:08X}n", 123);

This will print Hello 0x0000007B.

“`

Python

print(“Hello {:.3}”.format(1.0153)) “`

This will print Hello 1.02.

I’d like this lib mostly for consistency with my current sources in other languages. Does anyone know if such library exists? (I’ve tried to find one, but without any luck)

submitted by /u/suitable_character
[link] [comments]