format Questions
8
Solved
I was asked to do a work in C when I'm supposed to read from input until there's a space and then until the user presses enter.
If I do this:
scanf("%2000s %2000s", a, b);
It will follow the 1st...
3
Solved
I have a float value: 12345.6489
When I format this using:
(12345.6489f).ToString("F1")
Then I get a result of
12345.7
But this is incorrect, since it should be 12345.6.
Does anyone understan...
Liquidize asked 14/1, 2013 at 19:27
12
Solved
I'm using the C++ Extension for VSCode (Visual Studio Code).
Currently, I have the setting "C_Cpp.clang_format_formatOnSave" set to true.
This format's my code when I save my C++ file. But the fo...
Perverted asked 8/9, 2017 at 8:18
3
Solved
The format function in builtins seems to be like a subset of the str.format method used specifically for the case of a formatting a single object.
eg.
>>> format(13, 'x')
'd'
is appar...
Stricklin asked 22/5, 2013 at 4:33
6
Solved
How can I format the time elapsed from seconds to hours, mins, seconds?
My code:
start = time.time()
... do something
elapsed = (time.time() - start)
Actual Output:
0.232999801636
Desired/E...
9
Solved
I'm having a problem formatting cells in an Excel sheet. For some reason my code seems to be changing the style of all cells when I just want to change the style of a few specified, or a specified ...
3
Solved
I'd like Intl.NumberFormat() to automatically convert between units from smaller to bigger ones based on common rules. I.e. a given number should be converted to between centimeters, meters, and ki...
Adhesion asked 21/4, 2021 at 20:0
17
Solved
I'm having a problem with two dimensional array. I'm having a display like this:
1 2 3 4 5 6 7 9 10 11 12 13 14 15 16 . . . etc
What basically I want is to display to display it as:
1 2 3 4 5 6...
11
Solved
15
Solved
I'm trying to write a function to present thousands and millions into K's and M's
For instance:
1000 = 1k
1100 = 1.1k
15000 = 15k
115000 = 115k
1000000 = 1m
Here is where I got so far:
func for...
8
Solved
How can I do this format with a Python 3.6 F-String?
person = {'name': 'Jenne', 'age': 23}
print('My name {0[name]} and my age {1[age]}'.format(person, person))
print('My name {0} and my age {1}'....
Remiss asked 19/4, 2017 at 6:33
3
Solved
Basically, I am using the following code to parse string as LocalDateTime, which works fine most of the time.
DateTimeFormatter dtformatter = DateTimeFormatter.ofPattern("yyyyMMddHHmmssSSS");
H...
5
Solved
Why does this print the value of the memory address at 0x08480110? I'm not sure why there are 5 %08x arguments - where does that take you up the stack?
address = 0x08480110
address (encoded as 32...
7
Solved
Hi I need to remain only with the day of each date:
df<-data.frame(x=c("2014-07-24 00:00:00",
"2014-07-24 00:00:00", "2014-07-11", "2014-07-11" ,"2014-07-16" ,"2014-07-14"))
as.Date(df$x,forma...
11
Solved
I need to get the current timestamp in Java, with the format of MM/DD/YYYY h:mm:ss AM/PM,
For example: 06/01/2000 10:01:50 AM
I need it to be Threadsafe as well.
Can I utilize something like th...
35
Solved
2
Solved
I want to create a diagram from a pandas dataframe where the axes ticks should be percentages.
With matplotlib there is a nice axes formatter which automatically calculates the percentage ticks bas...
Effect asked 7/2, 2021 at 0:14
3
Solved
Using str.format() is the new standard for formatting strings in Python 2.6, and Python 3. I've run into an issue when using str.format() with regular expressions.
I've written a regular expressio...
Highlight asked 9/12, 2009 at 17:57
5
Solved
I'd like to format numbers with both thousands separator and specifying the number of decimals. I know how to do these separately, but not together.
For example, I use format per this for the deci...
5
Solved
Are System.out.printf and System.out.format totally the same or perhaps they differ in somehow?
2
Solved
Let's say I have a list datalist, with len(datalist) = 4. Let's say I want each of the elements in the list to be represented in a string in this way:
s = "'{0}'::'{1}'::'{2}' '{3}'\n".format(data...
Jegger asked 23/8, 2017 at 20:33
23
Solved
15
Solved
I have a function to add commas to numbers:
function commafy( num ) {
num.toString().replace( /\B(?=(?:\d{3})+)$/g, "," );
}
Unfortunately, it doesn't like decimals very well. Given the...
Cherlynchernow asked 22/7, 2011 at 1:52
2
Solved
I already saw a lot of question teaching how easy is to do it with comma as thousands separator:
>>> format(1123000,',d')
'1,123,000'
But if I try to use a dot, it goes nuts:
>>&...
Munro asked 24/1, 2018 at 4:3
5
I'd like to format a number to maximum N decimal places. There's another similar and popular question here, but that's not exactly what I'm looking for.
I'm looking for something like this, let's ...
Rhine asked 13/5, 2016 at 0:38
© 2022 - 2025 — McMap. All rights reserved.