string.format Questions
8
I've been using C# String.Format for formatting numbers before like this (in this example I simply want to insert a space):
String.Format("{0:### ###}", 123456);
output:
"123 456"
In this par...
Caracalla asked 7/10, 2014 at 10:11
6
Solved
I would like to use plurals for my Android project.
However, the values I provide can be float values.
So for instance, when setting 1.5 stars, I want this to understand, it's not 1 star but 1.5 ...
Quennie asked 26/2, 2019 at 10:6
16
Solved
Is there a perceptible difference between using String.format and String concatenation in Java?
I tend to use String.format but occasionally will slip and use a concatenation. I was wondering if o...
Nonconformity asked 29/5, 2009 at 10:51
3
Solved
I have looked at a couple of dozen similar questions - and I'm happy to just get a link to another answer - but I want to zero pad a floating point number in python 3.3
n = 2.02
print( "{?????}".f...
Digamma asked 4/3, 2015 at 2:6
22
Solved
I'm trying to move some JavaScript code from MicrosoftAjax to JQuery. I use the JavaScript equivalents in MicrosoftAjax of the popular .net methods, e.g. String.format(), String.startsWith(), etc. ...
Lenni asked 24/6, 2009 at 14:30
22
Solved
I'm trying to move some JavaScript code from MicrosoftAjax to JQuery. I use the JavaScript equivalents in MicrosoftAjax of the popular .net methods, e.g. String.format(), String.startsWith(), etc. ...
Anemometry asked 24/6, 2009 at 14:30
7
Solved
What I want is something like this:
String.Format("Value: {0:%%}.", 0.8526)
Where %% is that format provider or whatever I am looking for.
Should result: Value: %85.26..
I basically need it for...
Roundabout asked 24/11, 2009 at 15:54
6
Solved
I am using this method to form json string and this is working fine. But i can't handle this if it contains more properties. Is there any other better method than this?
string.Format("{0}{1}longUr...
Connie asked 30/7, 2013 at 10:40
11
Instead of using {0} {1}, etc. I want to use {title} instead. Then fill that data in somehow (below I used a Dictionary). This code is invalid and throws an exception. I wanted to know if i can do ...
Kila asked 18/6, 2009 at 0:6
36
Solved
How do I convert an integer into a binary string in Python?
37 → '100101'
Pulverize asked 31/3, 2009 at 3:4
2
Solved
This might been asked here couple of times.. what i am trying to do adding space between every four char of a string(8888319024981442). my string length is exactly 16. String.format is not helpful
...
Drucilladrucy asked 25/8, 2020 at 20:54
3
Solved
I'm using String.format() in Java trying to emulate the printf() control channel available in C. I understand how to specify that a string should be placed in a field which takes 20 characters, 5, ...
Hobnob asked 4/2, 2011 at 0:21
5
Solved
In the example below I would like to format to 1 decimal place but python seems to like rounding up the number, is there a way to make it not round the number up?
>>> '{:.1%}'.format(0.99...
Dubiety asked 12/7, 2013 at 8:30
1
Solved
I haven't found a way to only get exponents which are multiples of 3, when displaying numbers in the scientific format. Neither did I succeed writing a simple custom formatting function.
Here is a ...
Languor asked 24/6, 2020 at 17:58
4
Solved
I am using String.Format("{0:C2}", -1234) to format numbers.
It always formats the amount to a positive number, while I want it to become $ - 1234
Hesperian asked 16/6, 2009 at 12:18
8
Solved
I want to display the elapsed time between two dates in a string.
Let's say I have the following code:
DateTime date1 = DateTime.Now();
System.Threading.Thread.Sleep(2500);
DateTime date2 = DateT...
Ferbam asked 23/8, 2010 at 7:30
4
Solved
The new string interpolation style in Visual Studio 2015 is this:
Dim s = $"Hello {name}"
But if I use this the code analysis tells me I break CA1305: Specify IFormatProvider
In the old times I...
Lucent asked 18/8, 2015 at 15:39
2
Solved
Is there a way to break up a line of code so that it is read as continuous despite being on a new line in java?
public String toString() {
return String.format("BankAccount[owner: %s, balance: %...
Middlebrow asked 20/4, 2017 at 0:10
5
Solved
In the following code below, why do the two string.Format calls not behave the same way? In the first one, no exception is thrown, but in the second one an ArgumentNullException is thrown.
static ...
Papaya asked 7/11, 2012 at 19:4
1
Solved
What is the use of * in .format(*)?
When using it in the format function below print(new_string.format(*sum_string)) it changes the value of sum_string in the output from 18 to 1
Why does that happ...
Chaddie asked 24/9, 2018 at 8:29
4
Here is my question and its solution regarding this problem..
Em trying to pass textview value between different activities, and em getting a problem. when i execute the code, the app crashes on o...
Cristobal asked 10/10, 2015 at 7:6
6
Solved
I have a compressed string value I'm extracting from an import file. I need to format this into a parcel number, which is formatted as follows: ##-##-##-###-###. So therefore, the string "410151000...
Drank asked 19/10, 2010 at 13:28
1
Solved
I am reading from a data file that has 8 precision, then after interpolating some values I am saving them like where the float_format option is not working,
df.to_csv('data.dat',sep=' ', index=Fal...
Peugia asked 23/7, 2018 at 10:31
3
Solved
I am sending HTML email template using Bodybuilder and a mail sending service. I used this link learn.
https://www.c-sharpcorner.com/article/send-email-using-templates-in-asp-net-core-applications/...
Proceeds asked 14/6, 2018 at 8:0
1
Solved
I want to use the str.format() method like this:
my_str = "Username: {username}, User data: {user_data.attribute}".format(**items)
And apply it to items as shown below:
items = {
"username" : ...
Fanniefannin asked 2/3, 2018 at 13:46
1 Next >
© 2022 - 2024 — McMap. All rights reserved.