- Feature Articles
- CodeSOD
-
Error'd
- Most Recent Articles
- Scrollpocalypse
- Fast Quick
- 12345
- Said Different
- Ai Dios Mio
- Unrewarding
- Good Time
- Hello, New Mexico!
-
Forums
-
Other Articles
- Random Article
- Other Series
- Alex's Soapbox
- Announcements
- Best of…
- Best of Email
- Best of the Sidebar
- Bring Your Own Code
- Coded Smorgasbord
- Mandatory Fun Day
- Off Topic
- Representative Line
- News Roundup
- Editor's Soapbox
- Software on the Rocks
- Souvenir Potpourri
- Sponsor Post
- Tales from the Interview
- The Daily WTF: Live
- Virtudyne
Admin
TRWTF is not allowing
"#0.## \u2030"like in Java.Admin
This looks like they're trying to set-up an interpolated string (i.e.: $"{0:#,##0.00;(#,##0.00)}", which would just result in "0.00;(0.00)"). But as far as I know, you can't use interpolated strings like this:
But maybe this isn't C#, and it works just fine in whatever language they're using.
Edit Admin
If you're typing it frequently, you can use Option+Shift+R to type ‰ on macOS. But let's be honest, 99.999% of people (or 999.99‰ of people?) aren't typing it frequently and are going to have to google it, like I did just now.
Edit Admin
It's probably C# and I doubt they're trying to use the $ syntax. IMO more likely it's like this:
And you're correct about the $ syntax. MSFT says only works with a literal string. It's a compile-time transformation into formatting calls. See the first sentence here: https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/tokens/interpolated
Edit Admin
The designers of C
printfrealized long ago that you sometimes need to parameterize some of the formatting options, so you can use*in place of things like the field width to get the value from the arguments. This doesn't handle all the cases where you need to build format strings dynamically, but it gets the most common ones.