Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ Substring()

string MS.Internal.Xml.XPath.StringFunctions.Substring ( XPathNodeIterator nodeIterator)
inlineprivate

Definition at line 186 of file StringFunctions.cs.

187 {
188 string text = _argList[0].Evaluate(nodeIterator).ToString();
189 double num = XmlConvert.XPathRound(XmlConvert.ToXPathDouble(_argList[1].Evaluate(nodeIterator))) - 1.0;
190 if (double.IsNaN(num) || (double)text.Length <= num)
191 {
192 return string.Empty;
193 }
194 if (_argList.Count == 3)
195 {
197 if (double.IsNaN(num2))
198 {
199 return string.Empty;
200 }
201 if (num < 0.0 || num2 < 0.0)
202 {
203 num2 = num + num2;
204 if (!(num2 > 0.0))
205 {
206 return string.Empty;
207 }
208 num = 0.0;
209 }
210 double num3 = (double)text.Length - num;
211 if (num2 > num3)
212 {
213 num2 = num3;
214 }
215 return text.Substring((int)num, (int)num2);
216 }
217 if (num < 0.0)
218 {
219 num = 0.0;
220 }
221 return text.Substring((int)num);
222 }
static double ToXPathDouble(object o)
static double XPathRound(double value)

References MS.Internal.Xml.XPath.StringFunctions._argList, System.Collections.Generic.Dictionary< TKey, TValue >.Count, System.Xml.Dictionary, System.Xml.XmlConvert.ToXPathDouble(), and System.Xml.XmlConvert.XPathRound().

Referenced by MS.Internal.Xml.XPath.StringFunctions.Evaluate().