4,331 questions
-2 votes
2 answers
161 views
String not recognized as a valid DateTime [closed]
I'm receiving this date and time in US format from an upstream server I have no control over and can't change: 12/16/2024 11:30:23 AM I am trying to convert it to UK format using PowerShell: [DateTime]...
1 vote
1 answer
157 views
Why do characters after %s in printf replace the starting characters
I'm learning C and trying to debug with printf calls. But, when I format a string with %s and have characters immediately after, they end up replacing the characters at the beginning. Example: printf(&...
0 votes
1 answer
130 views
C++17 compiler warns "unknown conversion type character ‘.’ in format" for "%.12e" format string
I am updating some legacy code that is a mixture of C and C++. I am using a modern compiler (C++17) and building with Makefile. I get a warning for this line of code: sscanf(data_buffer, "%d,%....
0 votes
2 answers
95 views
Why am I getting an extra space here?
air_temperature = float(input()) print('{:C>.1f}'.format(air_temperature), 'C') Your output: 36.4 C Expected output 35.4C Error Message Why am I being told there is an extra space here that is ...
0 votes
0 answers
46 views
What's the proper way to group each 3 characters with comma?
This Excel-like layout is implemented using RecyclerView. For each EditTexts, the inputType is text because the requirement is to accepts these 2 formats: Numeric input (separated by comma each 3 ...
1 vote
1 answer
118 views
Format np.float64 without leading digits
I need to format np.float64 floating values without leading digits before the dot, for example -2.40366982307 as -.240366982307E+01, in python. This is to allow me to write in RINEX 3.03 the values ...
0 votes
0 answers
37 views
Streaming text from openai in next.js
"Streaming Text Formatting" – Formatting text that arrives in chunks from a stream. "Real-time Text Structuring" I am creating a web app using next.js and openai When I use openai ...
0 votes
0 answers
26 views
XAML String format causes type not found error but works
I am working on some old XAML that has a binding with a string format specified as {}{0,8:0.000} I believe the intent of this string format is to create a fixed length string with whitespace padding ...
1 vote
1 answer
127 views
Format number to a string such that spaces are inserted rather than 0s
When you convert some number to a string and pass in a format such as "00", it will insert 0's if the number doesn't have digits filling that spot. Example: 1.ToString("00") -> &...
1 vote
2 answers
118 views
Why aren't the string formats for the float equivalent, and why does "N9" produce a value that is different?
I would like to understand what is going on with this code: float flt = 0.123F; string s1 = flt.ToString("0.#########"); // "0.123" string s2 = flt.ToString("N9"); ...
1 vote
1 answer
153 views
C++23 formatting mdspan as matrix
I'm trying to specify a formatter to print mdspan of rank 2 as a matrix, quite useful. I would like at least for element formatting to work, e.g. std::println("{::.2e}", matrix) would print ...
3 votes
1 answer
190 views
String representation of a tree (nodes) data structure with paths from left to right
Given a tree-like data structure of nodes with each node having a property children that contains the children nodes from left to right, I wish to create a string representation of this data structure ...
0 votes
2 answers
71 views
WPF TextBox typing issue with StringFormat
Is there a way to "bypass" the dot and "override" the decimals when typing a value in a TextBox in WPF formatted with a 2 decimals via StringFormat='{}{0:F2} ? When I type "1....
-3 votes
3 answers
160 views
How to format printing an array in Python
I have an array of 10 elements and I can each of the elements print on a new line formatted 6.2f with print(f'{myArray:6.2f}', sep="\n") But I would like to create string containing what ...
0 votes
1 answer
271 views
How to format numbers with precision in strings when precision is only a runtime known value?
I have the following Zig snippet: var buffer: [20]u8 = undefined; const precise_string = std.fmt.bufPrint(&buffer, "{d:.d}", .{ max, precision }) catch unreachable; std.debug.print("...