Example #1
0
        public PostCodePlaats ParseZipCodeRow(string row)
        {
            var parsedRow = row.Split(new[] { "\n", "\r\n" }, StringSplitOptions.RemoveEmptyEntries).Select(x => x.Trim()).ToList();

            var postcodeplaats = parsedRow[0];

            string[] postcodeplaatsNodes = postcodeplaats.Split(new[] { " " }, StringSplitOptions.RemoveEmptyEntries);

            var postcodePlaats = new PostCodePlaats();

            if (postcodeplaatsNodes.Length == 2)
            {
                postcodePlaats.Postcode = WebUtility.HtmlDecode(postcodeplaatsNodes[0]);
                postcodePlaats.Plaats   = WebUtility.HtmlDecode(postcodeplaatsNodes[1]);
            }
            else
            {
                postcodePlaats.Postcode = $"{WebUtility.HtmlDecode(postcodeplaatsNodes[0])} {WebUtility.HtmlDecode(postcodeplaatsNodes[1])}";
                postcodePlaats.Plaats   = string.Empty;
                for (int i = 2; i < postcodeplaatsNodes.Length; i++)
                {
                    postcodePlaats.Plaats += $"{postcodeplaatsNodes[i]} ";
                }
            }

            if (postcodeplaatsNodes.Length == 3)
            {
                postcodePlaats.Plaats = WebUtility.HtmlDecode(postcodeplaatsNodes[2]);
            }
            return(postcodePlaats);
        }
Example #2
0
        public PostCodePlaats ParseZipCodeRow(string row)
        {
            var parsedRow = row.Split(new[] { "\n", "\r\n" }, StringSplitOptions.RemoveEmptyEntries).Select(x => x.Trim()).ToList();

            var postcodeplaats = parsedRow[0];

            string[] postcodeplaatsNodes = postcodeplaats.Split(new[] {" "}, StringSplitOptions.RemoveEmptyEntries);

            var postcodePlaats = new PostCodePlaats();
            if (postcodeplaatsNodes.Length == 2)
            {
                postcodePlaats.Postcode = WebUtility.HtmlDecode(postcodeplaatsNodes[0]);
                postcodePlaats.Plaats = WebUtility.HtmlDecode(postcodeplaatsNodes[1]);
            }
            else
            {
                postcodePlaats.Postcode = $"{WebUtility.HtmlDecode(postcodeplaatsNodes[0])} {WebUtility.HtmlDecode(postcodeplaatsNodes[1])}";
                postcodePlaats.Plaats = string.Empty;
                for (int i = 2; i < postcodeplaatsNodes.Length; i++)
                {
                    postcodePlaats.Plaats += $"{postcodeplaatsNodes[i]} ";
                }
            }

            if (postcodeplaatsNodes.Length == 3)
            {
                
                postcodePlaats.Plaats = WebUtility.HtmlDecode(postcodeplaatsNodes[2]);
            }
            return postcodePlaats;
        }
Example #3
0
        public PostCodePlaats ParseZipCodeRow(string row)
        {
            var parsedRow      = row.Split(new[] { "\n", "\r\n" }, StringSplitOptions.RemoveEmptyEntries).Select(x => x.Trim()).ToList();
            var postcodePlaats = new PostCodePlaats();

            postcodePlaats.Postcode = WebUtility.HtmlDecode(parsedRow[0]);
            postcodePlaats.Plaats   = WebUtility.HtmlDecode(parsedRow[1]);
            return(postcodePlaats);
        }
Example #4
0
 public PostCodePlaats ParseZipCodeRow(string row)
 {
     var parsedRow = row.Split(new[] { "\n", "\r\n" }, StringSplitOptions.RemoveEmptyEntries).Select(x => x.Trim()).ToList();
     var postcodePlaats = new PostCodePlaats();
     postcodePlaats.Postcode = WebUtility.HtmlDecode (parsedRow[0]);
     postcodePlaats.Plaats = WebUtility.HtmlDecode (parsedRow[1]);
     return postcodePlaats;
 }