• 软件测试技术
  • 软件测试博客
  • 软件测试视频
  • 开源软件测试技术
  • 软件测试论坛
  • 软件测试沙龙
  • 软件测试资料下载
  • 软件测试杂志
  • 软件测试人才招聘
    暂时没有公告

字号: | 推荐给好友 上一篇 | 下一篇

Using the Locale Identifier (LCID) (1)

发布: 2007-6-30 18:56 | 作者: admin | 来源: | 查看: 13次 | 进入软件测试论坛讨论

领测软件测试网 Introduction:
When you use the VBScript functions FormatNumber, FormatDateTime, and FormatCurrency, the output displayed is based upon the regional settings of your Web server. (To learn more about these functions check out the technical docs (FormatCurrency | FormatDateTime | FormatNumber) or this FAQ.) For example, if you have your regional settings to English - United States, when running the following code from an ASP page:

Response.Write FormatNumber(123456789) & "<br>"
Response.Write FormatCurrency(987654321)  


You will get the following output:
123,456,789.00
$987,654,321.00

Note that both include two digits after the decimal by default, that set of three digits to the left of the decimal place is grouped by a comma, and that the decimal place is represented by a period. While US visitors may be accustomed to this format, many Europeans are more familiar with a system that uses spaces instead of commas and commas instead of periods.

For example, someone from France may be more comfortable with the following output:
123 456 789,00
987 654 321,00 F

Of course, due to exchange rates, 987,654,321 francs and 876,654,321 dollars are not equivalent, but a visitor from France would, most likely, prefer to see m.netary rates in their natural currency.

Regional Settings:
The values FormatNumber and FormatCurrency functions output is customizable, based on the regional settings of the Web server. To alter the Web server‘’s regional settings you need to have Administrator access to the machine itself. Start by opening the Control Panel (Start/Settings/Control Panel) and double click on the Regional Options icon. This will open a dialog box similar to the one below. In the first tab, you can select the Web server‘’s default locale setting. There are a plethora of locales you can select, all of them highly customizable.



Take a moment to examine the dialog box: notice that there are tabs for the Numbers, Currency, and Date and Time for the selected locale. These settings are all customizable. So, if you chose your locale to be English (United States) but wanted to, by default, show four digits after the decimal place, you could move over to the Numbers tab and make this option. The screenshot below is of the Numbers tab showing all of the settings you can specify for the selected locale.



While specifying a default locale setting, which inherently effects the output of VBScript‘’s Format functions, is useful and handy, what if we want to, for some users or for some occassions, use a different locale setting? How can we accomplish this? We‘’ll examine exactly how to using the LCID property of the Session object in Part 2. 

文章来源于领测软件测试网 https://www.ltesting.net/


关于领测软件测试网 | 领测软件测试网合作伙伴 | 广告服务 | 投稿指南 | 联系我们 | 网站地图 | 友情链接
版权所有(C) 2003-2010 TestAge(领测软件测试网)|领测国际科技(北京)有限公司|软件测试工程师培训网 All Rights Reserved
北京市海淀区中关村南大街9号北京理工科技大厦1402室 京ICP备10010545号-5
技术支持和业务联系:info@testage.com.cn 电话:010-51297073

软件测试 | 领测国际ISTQBISTQB官网TMMiTMMi认证国际软件测试工程师认证领测软件测试网