Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
29269 Diskussionen

I can NLSGetLocaleInfo, but how do I "NLS-Set-LocaleInfo"?

MikeWinsteps
Anfänger
1.117Aufrufe

The NLS_LI Parameter List in the Intel  FORTRAN Developer Guide includes settings I need for customized date, time and number formats. How do I invoke these in code or in Project Properties? Thx.

0 Kudos
5 Antworten
DavidWhite
Geschätzter Beitragender II
1.087Aufrufe

I found this link:

https://www.intel.com/content/www/us/en/docs/fortran-compiler/developer-guide-reference/2023-0/nlssetlocale.html

 

Hope that's helpful.

 

Having worked across several locales with data files which could have been created with different formats, I found that it was important to be able to determine which locate the data file had been created in, rather than assuming that the current locale was correct.  This got tricky when my app created data files which users could open as a CSV file in Excel, so getting the dividers and the decimal points correct was critical.

MikeWinsteps
Anfänger
1.069Aufrufe

Thanks, David. The next challenge is to discover which of the 100+ countries has the format I need. But even this will not help if IFORT does not act on them automatically. For instance, if the locale says "no leading zeros", but IFORT always does leading zeros, then I'll have to code a work-around.

DavidWhite
Geschätzter Beitragender II
1.055Aufrufe

Hi Mike,

 

My understanding is that you can format numbers, time and date using functions from the IFNLS library

 

See the examples at https://www.intel.com/content/www/us/en/docs/fortran-compiler/developer-guide-reference/2023-1/nls-and-mcbs-routines-on-windows.html

 

My code was simpler, since I only needed to know the decimal point and separator characters.

 

Hope that points you in the right direction.

 

MikeWinsteps
Anfänger
1.013Aufrufe

Thanks for the link, David. It confirms what I suspected.

NLS is too awkward, so have written my own formatting routines. 

andrew_4619
Geehrter Beitragender III
992Aufrufe
Antworten