Top "String-formatting" questions

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

PHP remove first zeros

Want to remove all 0 placed at the beginning of some variable. Some options: if $var = 0002, we should strip first 000 ($var = 2) …

php formatting string-formatting zero number-formatting
How to create a NSString from a format string like @"xxx=%@, yyy=%@" and a NSArray of objects?

Is there any way to create a new NSString from a format string like @"xxx=%@, yyy=%@" and a NSArray of …

objective-c cocoa nsstring nsarray string-formatting
How to mask string?

I have a string with value "1131200001103". How can I display it as a string in this format "11-312-001103" using …

c# string string-formatting masking
How to format message with argument names instead of numbers?

I have something like: String text = "The user {0} has email address {1}." // params = { "Robert", "[email protected]" } String msg = MessageFormat.format(…

java string-formatting
python format string thousand separator with spaces

For printing number with thousand separator, one can use the python format string : '{:,}'.format(1234567890) But how can I …

python string-formatting
Better String formatting in Scala

With too many arguments, String.format easily gets too confusing. Is there a more powerful way to format a String. …

string scala formatting string-formatting
Add comma thousand separator to decimal (.net)

I have a decimal number, say 1234.500. I want to display it as 1,234.5. I'm currently converting it to a double to …

.net formatting string-formatting number-formatting
Is there a "String.Format" that can accept named input parameters instead of index placeholders?

This is what I know str = String.Format("Her name is {0} and she's {1} years old", "Lisa", "10"); But I want something …

c# .net string string-formatting
how to format hex numbers using stringstream

I am trying to convert an unsigned short to its hexadecimal representation in uppercase and prefixed with 0's using stringstream. …

c++ c++11 hex string-formatting stringstream
Right padding with zeros in Java

Sorry if this question was made already, I've made a deep search and nothing. Now, I know that: String.format("%05…

java string-formatting padding