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

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

MikeWinsteps
Novice
708 Views

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 Replies
DavidWhite
Valued Contributor II
678 Views

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.

0 Kudos
MikeWinsteps
Novice
660 Views

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.

0 Kudos
DavidWhite
Valued Contributor II
646 Views

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.

 

0 Kudos
MikeWinsteps
Novice
604 Views

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

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

0 Kudos
andrew_4619
Honored Contributor III
583 Views
0 Kudos
Reply