Chronic.Numerizer.Andition C# (CSharp) Method

Andition() static private method

static private Andition ( string value ) : string
value string
return string
        static string Andition(string value)
        {
            var result = value;
            var pattern = @"<num>(\d+)( | and )<num>(\d+)(?=[^\w]|$)".Compile();
            while (true)
            {
                var match = pattern.Match(result);
                if (match.Success == false)
                    break;
                result = result.Substring(0, match.Index) +
                    "<num>" + ((int.Parse(match.Groups[1].Value) + int.Parse(match.Groups[3].Value)).ToString()) +
                    result.Substring(match.Index + match.Length);
            }
            return result;
        }