Top "String-formatting" questions

Commonly refers to a number of methods to display an arbitrary number of varied data types into a string.

Should I use Java's String.format() if performance is important?

We have to build Strings all the time for log output and so on. Over the JDK versions we have …

java string performance string-formatting micro-optimization
How to convert milliseconds into human readable form?

I need to convert an arbitrary amount of milliseconds into Days, Hours, Minutes Second. For example: 10 Days, 5 hours, 13 minutes, 1 second.

date time string-formatting datetime-format
Format in kotlin string templates

Kotlin has an excellent feature called string templates. I really love it. val i = 10 val s = "i = $i" // evaluates to "…

string-formatting kotlin
When to use %r instead of %s in Python?

On Learn Python the Hard Way page 21, I see this code example: x = "There are %d types of people." % 10 ... print "…

python string string-formatting
How to format a QString?

I'd like to format a string for Qt label, I'm programming in C++ on Qt. In ObjC I would write …

c++ qt string-formatting
How to get 0-padded binary representation of an integer in java?

for example, for 1, 2, 128, 256 the output can be (16 digits): 0000000000000001 0000000000000010 0000000010000000 0000000100000000 I tried String.format("%16s", Integer.toBinaryString(1)); it puts spaces for left-padding: ` 1…

java binary string-formatting
String.Format not work in TypeScript

String.Format does not work in TypeScript. Error: The property 'format' does not exist on value of type '{ prototype: …

javascript string typescript string-formatting
Python SQL query string formatting

I'm trying to find the best way to format an sql query string. When I'm debugging my application I'd like …

python sql string-formatting
Format a JavaScript string using placeholders and an object of substitutions?

I have a string with say: My Name is %NAME% and my age is %AGE%. %XXX% are placeholders. We need …

javascript jquery string string-formatting