代码之家  ›  专栏  ›  技术社区  ›  Manish Basantani

“格式”的反面是什么?

  •  2
  • Manish Basantani  · 技术社区  · 14 年前

    我正在创建一个业务项格式化程序(Spread),在显示时,我希望在将数字乘以100后显示该数字,出于所有计算目的,我希望从显示(文本框)中读取该数字,将其解析为双精度,然后将其除以100。

    SpreadFormatter {
        public string Format(double originalValue){
             //Please dont mind this logic/approach. I am just represeting the scenario.
             return (originalValue * 100).ToString();
        }
    
        public double SuggestAName(string currentValue){
             //Please dont mind this logic/approach. I am just represeting the scenario.         
             return Double.Parse(currentValue)/100 ;
        }
    }
    

    我正在为上面的“suggestaname”方法寻找合适的名称。

    谢谢你的关心。

    2 回复  |  直到 14 年前
        1
  •  5
  •   T.J. Crowder    14 年前

    Parse Format ToDisplayFormat FromDisplayFormat

        2
  •  0
  •   Christoffer    14 年前

    public double Parse(string currentValue)