VBS教程:函數-SetLocale 函數

來源:互聯網
上載者:User

SetLocale 函數

Sets the global locale and returns the previous locale.

SetLocale(lcid)

lcid 參數可以是任意一個合法的 32 位元值或短字串,該值必須唯一標識一個地理地區。能被識別的值可以查閱 地區設定識別碼 表。

說明

lcid 為零,地區被設定為與當前系統設定匹配。

一個 locale 是使用者參考資訊集合,與使用者的語言、國家和文化傳統有關。該 locale 決定鍵盤配置、字母排序次序和日期、時間、數字與貨幣格式。

下面舉例說明 SetLocale 函數的用法。要使用該代碼,請複製標準HTML 檔案中 <BODY> 標誌之間的所有內容。

Enter Date in UK format: <input type="text" id="UKDate" size="20"><p>Here's the US equivalent: <input type="text" id="USdate" size="20"><p><input type="button" value="Convert" id="button1"><p>Enter a price in German:   <input type="text" id="GermanNumber" size="20"><p>Here's the UK equivalent: <input type="text" id="USNumber" size="20"><p><input type="button" value="Convert" id="button2"><p><script language="vbscript">Dim currentLocale' Get the current localecurrentLocale = GetLocaleSub Button1_nclick  Dim original  original = SetLocale("en-gb")  mydate = CDate(UKDate.value)  ' IE always sets the locale to US English so use the  ' currentLocale variable to set the locale to US English  original = SetLocale(currentLocale)  USDate.value = FormatDateTime(mydate,vbShortDate)End SubSub button2_nclick  Dim original  original = SetLocale("de")  myvalue = CCur(GermanNumber.value)  original = SetLocale("en-gb")  USNumber.value = FormatCurrency(myvalue)End Sub</script> 
請參閱

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.