[csharp] view plaincopyprint? using System; using System.Collections.Generic; using System.Text; using System.Runtime.Serialization.Formatters.Binary; using System.IO; namespace smsForCsharp.CRC { /// <summary> /// 消息CRC校验算法 /// </summary> pub
js保留2位小数toFixed(xxxx) var a = 9.39393; alert(a.toFixed()); alert(Number.toFixed(9.39393)); 返回的是9. 对于一些小数点后有多位的浮点数,我们可能只需要保留2位,但js没有提供这样直接的函数,所以我们得自己写函数实现这个功能,代码如下: function changeTwoDecimal(x) { var f_x = parseFloat(x); if (isNaN(f_x)) { alert('funct
1. 最笨的办法 function get() { var s = 22.127456 + ""; var str = s.substring(0,s.indexOf(".") + 3); alert(str); } 2. 正则表达式效果不错 <script type="text/javascript"> onload = function(){ var a = "23.456322"; var aNew; var
Low-Level API These are advanced, low-level API features that should, for most people not be necessary to worry about. They are lightly documented here, and in the future will have more documentation, but the emphasis at this point is documenting the