Beispiel #1
0
        public List <HandyHaversacks> getAllTheBags(string[] input)
        {
            var listOfBags = new List <HandyHaversacks> {
            };

            foreach (var item in input)
            {
                var bag = new HandyHaversacks(item);
                listOfBags.Add(bag);
            }
            return(listOfBags);
        }
Beispiel #2
0
        private List <HandyHaversacks> getBagContents(string input)
        {
            var contentString     = input.Replace("contain", ":").Split(':')[1];
            var contents          = contentString.Split(',');
            var formattedContents = new List <HandyHaversacks> {
            };

            foreach (var content in contents)
            {
                var cleanedContent = Regex.Replace(content, @"[\d-]", string.Empty).Replace("bags", "").Replace("bag", "").Replace(".", "").Trim();
                var number         = Int32.Parse(Regex.Match(content.Replace("no", "0"), @"[\d-]").Value);
                var bag            = new HandyHaversacks(cleanedContent, number);
                formattedContents.Add(bag);
            }
            return(formattedContents);
        }