3 ms·
I don't know about you, but for me it's pretty common to output numbers that I then use in the program. So you have to distinguish between output meant for a p
by ars 11y ago
I don't know about you, but for me it's pretty common to output numbers that I then use in the program.
So you have to distinguish between output meant for a program and output meant for human.
Say someone gives you a logfile of problematic transactions - you then have to convert all the numbers to decimal points before using them in some one-off program that checks them.
- afandian 11y agoNot wishing to condescend, but where it matters, there are standard ways of doing this. For example, the standard library of .NET and Java have date format localisation so they can deal with local time zones and read and write dates. They have standard local methods for localized string joining strings, numbers and currencies. Here are two articles: https://msdn.microsoft.com/en-us/library/1ksz8yb7(v=vs.110).aspx https://msdn.microsoft.com/en-us/library/1ksz8yb7(v=vs.110).... https://msdn.microsoft.com/en-us/library/5hh873ya(v=vs.90).aspx https://msdn.microsoft.com/en-us/library/5hh873ya(v=vs.90).a... If you don't want to write software for anyone but yourself or people in an identical environment that's fine, but if you want to write software for other people then there's lots of library support.
- mikestew 11y agoSo you have to distinguish between output meant for a program and output meant for human. That pretty much defines my career, yes. Say someone gives you a logfile of problematic transactions - you then have to convert all the numbers to decimal points before using them in some one-off program that checks them. Say someone gives me a MongoDB full of transactions that need to be transformed into relational data for our data warehouse...hey, I'll bet I could make a career out of this. I truly don't mean to be trite, but what you describe is just the way of things. In your log file example, a regex would more than likely solve the problem. One loop, a readln() and a writeln(), sorted. People do it everyday. Hell, I'll probably do something similar before the day is out.
- ars 11y agoI'm not trying to be annoying - I'm simply curious. I never had to deal with that (internally that is, I do localize for end users - but that data is one way), and I was wondering how people handled it, that's all. Sounds like it's a bit annoying, but you just deal with it because you have to. I guess it's a slight extra use of time, but nothing major?
- nl 11y agoMuch, much worse is the US mm/DD/yyyy format, especially if mixed with DD/mm/yyyy format, unlabeled, in the same file.
- ars 11y agoSee, that's kinda my question. As a programmer I refuse to use anything except yyyy-mm-dd, unless I'm forced to. So do Europeans analogously refuse to use anything except decimal points, except where they have to?
- rasapetter 11y agoAre you sure you didn't mean to write yyyy-mm-dd?
- ars 11y agoI did, thanks I fixed it. (If you delete your post, I'll delete mine and we won't clutter the thread.)
- Symbiote 11y agoBritain and Ireland use the "American" way (presumably, it's actually the British way). Displaying English-formatted numbers is incorrect in the rest of Europe, and will confuse users. Programming languages handle this, but you still write pi = 3.14 in the code. Note 123.456,78 is German, but Swiss is 123'456,78. I think. (Displaying miles and yards, inches and 'letter' sized paper is also incorrect, but it's unfortunately not uncommon.)
- 11y ago