flymis/WebRoot/dojojs/src/i18n/currency/common.js
(开头部分) 12KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
/*
Copyright (c) 2004-2006, The Dojo Foundation
All Rights Reserved.
Licensed under the Academic Free License version 2.1 or above OR the
modified BSD license. For more information on Dojo licensing, see:
http://dojotoolkit.org/community/licensing.shtml
*/
dojo.provide("dojo.i18n.currency.common");
dojo.require("dojo.experimental");
dojo.experimental("dojo.i18n.currency");
dojo.require("dojo.regexp");
dojo.require("dojo.i18n.common");
dojo.require("dojo.i18n.number");
dojo.require("dojo.lang.common");
/**
* Method to Format and validate a given number a monetary value
*
* @param Number value
* The number to be formatted and validated.
* @param String iso the ISO 4217 currency code
* @param Object flags
* flags.places The number of decimal places to be included in the formatted number
* @param String locale the locale to determine formatting used. By default, the locale defined by the
* host environment: dojo.locale
* @return String
* the formatted currency of type String if successful; Nan if an
* invalid currency is provided or null if an unsupported locale value was provided.
**/
dojo.i18n.currency.format = function(value, iso, flags /*optional*/, locale /*optional*/){
flags = (typeof flags == "object") ? flags : {};
var formatData = dojo.i18n.currency._mapToLocalizedFormatData(dojo.i18n.currency.FORMAT_TABLE, iso, locale);
if (typeof flags.places == "undefined") {flags.places = formatData.places;}
if (typeof flags.places == "undefined") {flags.places = 2;}
flags.signed = false;
var result = dojo.i18n.number.format(value, flags, locale);
var sym = formatData.symbol;
if (formatData.adjSpace == "symbol"){
if (formatData.placement == "after"){
sym = " " + sym;// TODO: nbsp?
}else{
sym = sym + " ";// TODO: nbsp?
}
}
if (value < 0){
if (formatData.signPlacement == "before"){
sym = "-" + sym;
}else if (formatData.signPlacement == "after"){
sym = sym + "-";
}
}
后面还有 229 行代码,购买后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。