/// <summary> /// Gets the resolved text where the expression have been evaluated, the resolved text is cached so do not worry about calling this multiple times /// </summary> /// <returns>The resolved text where the expression have been evaluated</returns> public string GetResolvedText() { if (resolvedTextNeedCache) { int start = SimpleText.IndexOf(OpeningExpressionDelimiter); int end = SimpleText.IndexOf(ClosingExpressionDelimiter); if (start == -1) { return(SimpleText); } double result = new MathExpression(SimpleText.Substring(start + 1, end - start - 1)).Evaluate(); cachedResolvedText = SimpleText.Replace(SimpleText.Substring(start, end - start + 1), result.ToString(formatStr, CultureInfo.InvariantCulture)); } return(cachedResolvedText); }