我目前正在研究一个酒店管理系统的发票(asp.net c#)...我的问题是,如果总金额是8023.25,那么如何在标签示例上展示圆整标签应该显示.25和totallabel应该显示8023 ...请有人帮我这个{带代码} ???
您可以拆分它并使用它们:
string s = inputValue.ToString("8023.25", CultureInfo.InvariantCulture);
string[] parts = s.Split('.');
int i1 = int.Parse(parts[0]);
int i2 = int.Parse(parts[1]);
你可以用数学方法做到:
int
进行投射,获得不可或缺的部分。double amt = 8023.25;
int value = (int)amt; //value will become 8023
double fraction = amt - value; //fractionwill become 0.25