Be concise.
Be useful.
All contributions dictatorially edited by webmasters to match personal tastes.
Please do not paste any copyright violating material.
Please try to avoid dependencies to third-party libraries and frameworks.
- C
- C++
- C#
- Dart
- Elixir
- Fortran
- Go
- JS
- Java
- Java
- Java
- Java
- Kotlin
- Lua
- PHP
- Pascal
- Pascal
- Pascal
- Perl
- Python
- Python
- Python
- Ruby
- Rust
- Rust
s = std::format("Our sun has {} planets", x);
s = "Our sun has #{x} planets"
write (unit=s,fmt='(*(G0))') "Our sun has ",x," planets."
s has to be long enough.
String f = "Our sun has {0,number} planets",
s = format(f, x);
"... MessageFormat provides a means to produce concatenated messages in a language-neutral way. Use this class to construct messages displayed for end users."
Formatter f = new Formatter();
f.format("Our sun has %s planets", x);
f.flush();
String s = f.toString();
String s = "Our sun has %s planets".formatted(x);
String s = String.format("Our sun has %s planets", x);
local str=string.format("Our sun has %d planets",x)
$s = "Our sun has {$x} planets";
$s = "Our sun has $x planets"
s = 'Our sun has {} planets'.format(x)
s = 'Our sun has %s planets' % x
s = f'Our sun has {x} planets'
s = "Our sun has #{x} planets."
let s = format!("Our sun has {x} planets");
Rust >= 1.58