private string getFinalString(fractionType fractionType) { char[] fractionCharArray = this.fraction.ToCharArray(); string finalstring = string.Empty; if (fractionType == fractionType.FirstName) { foreach (char c in fractionCharArray) { if (!c.Equals('<')) { finalstring = finalstring + c.ToString(); } } } else if (fractionType == fractionType.LastName) { foreach (char c in fractionCharArray) { if (!c.Equals('>')) { finalstring = finalstring + c.ToString(); } } } else if (fractionType == fractionType.FullName) { foreach (char c in fractionCharArray) { if (!c.Equals('>') && !c.Equals('<')) { finalstring = finalstring + c.ToString(); } } } else if (fractionType == fractionType.Phone) { foreach (char c in fractionCharArray) { if (c.Equals('-')) { finalstring = finalstring + c.ToString(); } else if (int.TryParse(c.ToString(), out int cInt)) { finalstring = finalstring + cInt.ToString(); } } } else if (fractionType == fractionType.Address) { finalstring = finalstring + this.fraction.Trim(); } else { throw new ArgumentException("Unreconized Type"); } return(finalstring); }
public Dictionary <fractionType, string> GetResult() { fractionType fractionType = this.getFractionType(); this.fractionDict.Add(fractionType, this.getFinalString(fractionType)); return(this.fractionDict); }