private string Substring(XPathNodeIterator nodeIterator) { string str1 = argList[0].Evaluate(nodeIterator).ToString(); double num = XmlConvertEx.XPathRound(XmlConvertEx.ToXPathDouble(argList[1].Evaluate(nodeIterator))) - 1; if (Double.IsNaN(num) || str1.Length <= num) { return(string.Empty); } if (argList.Count == 3) { double num1 = XmlConvertEx.XPathRound(XmlConvertEx.ToXPathDouble(argList[2].Evaluate(nodeIterator))); if (Double.IsNaN(num1)) { return(string.Empty); } if (num < 0 || num1 < 0) { num1 = num + num1; // NOTE: condition is true for NaN if (!(num1 > 0)) { return(string.Empty); } num = 0; } double maxlength = str1.Length - num; if (num1 > maxlength) { num1 = maxlength; } return(str1.Substring((int)num, (int)num1)); } if (num < 0) { num = 0; } return(str1.Substring((int)num)); }
private double Round(XPathNodeIterator nodeIterator) { double n = XmlConvertEx.ToXPathDouble(arg.Evaluate(nodeIterator)); return(XmlConvertEx.XPathRound(n)); }