Top "String-formatting" questions

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

String.Format way to format Currency without Cents

I'm displaying currency using the current method String.Format("{0:C}", item.DonationAmount) Which outputs like $10.00 We will be dealing with …

.net-core string-formatting
Convert int to hex with leading zeros

How to convert int (4 bytes) to hex ("XX XX XX XX") without cycles? for example: i=13 hex="00 00 00 0D" i.ToString("…

c# hex string-formatting
How to print the sign + of a digit for positive numbers in Python

Is there a better way to print the + sign of a digit on positive numbers? integer1 = 10 integer2 = 5 sign = '' total = …

python string-formatting
How can I format a std::string using a collection of arguments?

Is it possible to format std::string passing a set of arguments? Currently I am formatting the string this way: …

c++ string-formatting stdstring variadic-functions
WPF StringFormat={0:C} showing as dollars

Why does this line of code <TextBlock Text="{Binding Net, StringFormat=c}"/> Output the result as $xx.xx …

wpf binding currency regional string-formatting
Getting the current time as a YYYY-MM-DD-HH-MM-SS string

I'm trying to get the current time as a "YYYY-MM-DD-HH-MM-SS" formatted string in an elegant way. I can take the …

c++ boost string-formatting boost-date-time
str.format() raises KeyError

The following code raises a KeyError exception: addr_list_formatted = [] addr_list_idx = 0 for addr in addr_list: # addr_list …

python syntax string-formatting delimiter missing-data
Python: String Formatter Align center

print('%24s' % "MyString") # prints right aligned print('%-24s' % "MyString") # prints left aligned How do I print it …

python string-formatting text-alignment
casting NSInteger into NSString

I'm trying to make one string out of several different parts. This below is what i have right now. I …

objective-c ios nsstring string-formatting nsinteger
Format BigDecimal without scientific notation with full precision

I'd like to convert a BigDecimal to String for printing purposes but print out all digits without scientific notation. For …

java string-formatting bigdecimal