public string Perform(string input) { var strings = Regex.Matches(_context.Token, Constants.Token, RegexOptions.Compiled) .Cast <Match>() .Select(m => m.Value) .ToArray(); decimal result; var decimals = Array.ConvertAll(strings, Utilities.ParseDecimal); // small hack if (_context.Token.Contains("--") == false) { result = decimals[0] - Math.Abs(decimals[1]); } else { result = decimals[0] - decimals[1]; } input = _context.ReplaceAt(input, result); return(input); }
public string Perform(string input) { var strings = Regex.Matches(_context.Token, Constants.Token, RegexOptions.Compiled) .Cast <Match>() .Select(m => m.Value) .ToArray(); var decimals = Array.ConvertAll(strings, Utilities.ParseDecimal); var result = decimals[0] + decimals[1]; input = _context.ReplaceAt(input, result); return(input); }