/// <summary>
/// 用来截取小数点后nleng位
/// </summary>
/// <param name="sString">sString原字符串。</param>
/// <param name="nLeng">nLeng长度。</param>
/// <returns>处理后的字符串。</returns>
public string VarStr(string sString, int nLeng)
{
int index = sString.IndexOf(".");
if (index == -1 || index + nLeng >= sString.Length)
return sString;
else
return sString.Substring(0, (index + nLeng + 1));
}
用处://使格式更加规范,都截取的所有字符串的小数点的后两位
//绑定市场价格
public string GetVarMKP(string strMarketPrice)
{
return ccObj.VarStr(strMarketPrice, 2);
}
//绑定热卖价格
public string GetVarHot(string strHotPrice)
{
return ccObj.VarStr(strHotPrice, 2);
}