public string EvaluateRules(string inputString) { long parsedNumber = 0; var result = string.Empty; if (Int64.TryParse(inputString, out parsedNumber)) { result = foobarqixruledividers.ApplyRule(inputString); result += foobarqixrulecontains.ApplyRule(inputString); } else { logger.Error($"The input value [{parsedNumber}] is not a valid number"); } return(result); }
/// <summary> /// Builds the string using the division rules. /// </summary> /// <param name="dividerresult">The string returned after applying the division rules</param> /// <param name="number">The number to be evaluated</param> /// <returns>The string returned after applying the contains rules</returns> public string BuildString(string dividerresult, string number) { var result = string.Empty; try { if ((string.IsNullOrEmpty(dividerresult.Trim()) && (!number.AsEnumerable <char>() .Select(x => int.Parse(x.ToString())) .Any(x => foobarqixruledividers.DicDividerRules.ContainsKey(x))))) { result = number.Replace('0', '*'); } else { result = number.Aggregate(result, (current, t) => current + foobarqixrulecontains.ApplyRule(t.ToString())); } } catch (Exception ex) { logger.Error("BuildStringByContainsRules Error: " + ex.Message); } return(result.ToString()); }