随笔,平日工作小记
编译器将发出错误信息:
SpecialSetupChain is inaccessible due to its protection level.
因为:SetupUCChain的访问级别为 private ,改为 public,即可
public SetupUCChain(){...}
public class SetupUCChain
{
private SetupUCChain()
{
}
protected virtual void Init()
{
}
}
public class SpecialSetupChain : SetupUCChain
{
protected override void Init()
{
}
}
SpecialSetupChain is inaccessible due to its protection level.
因为:SetupUCChain的访问级别为 private ,改为 public,即可
public SetupUCChain(){...}
public class SetupUCChain
{
private SetupUCChain()
{
}
protected virtual void Init()
{
}
}
public class SpecialSetupChain : SetupUCChain
{
protected override void Init()
{
}
}
有这样一个数组:var strings = "6:0.03;7:0.04;8:0.05;"
只要取:如果只取0.03的话
function getTwoPoint()
{
var regRule = new RegExp("(^|;)" + parseInt(6) + ":([0-9\\.]+)(;|$)");
var payFeeRate = payFeeRateList.match(regRule)[2];
payFeeRate = 0.03;
}
RMB 1900,如果想显示成1,900的话
function formatCur(){
var m_num = this.toString();
if (/[^0-9\.\-]/.test(m_num))
{
return m_num;
}
m_num = m_num.replace(/^(\d*)$/,"$1.");
m_num = (m_num + "00").replace(/(\d*\.\d\d)\d*/,"$1");
m_num = m_num.replace(".",",");
var re = /(\d)(\d{3},)/;
while (re.test(m_num))
{
m_num = m_num.replace(re,"$1,$2");
}
m_num = m_num.replace(/,(\d\d)$/,".$1");
return m_num.replace(/^\./,"0.");
}
var number=1900;
number.formatCur();
result = 1,900.00
result = result.substring(0,result.length-3);
只要取:如果只取0.03的话
function getTwoPoint()
{
var regRule = new RegExp("(^|;)" + parseInt(6) + ":([0-9\\.]+)(;|$)");
var payFeeRate = payFeeRateList.match(regRule)[2];
payFeeRate = 0.03;
}
RMB 1900,如果想显示成1,900的话
function formatCur(){
var m_num = this.toString();
if (/[^0-9\.\-]/.test(m_num))
{
return m_num;
}
m_num = m_num.replace(/^(\d*)$/,"$1.");
m_num = (m_num + "00").replace(/(\d*\.\d\d)\d*/,"$1");
m_num = m_num.replace(".",",");
var re = /(\d)(\d{3},)/;
while (re.test(m_num))
{
m_num = m_num.replace(re,"$1,$2");
}
m_num = m_num.replace(/,(\d\d)$/,".$1");
return m_num.replace(/^\./,"0.");
}
var number=1900;
number.formatCur();
result = 1,900.00
result = result.substring(0,result.length-3);