using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

namespace IPAddress
{
    public partial class _Default : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void Button1_Click(object sender, EventArgs e)
        {
            string result = "";
            // "127.000.001.022"
            string[] parts = RadMaskedTextBox1.TextWithLiterals.Split('.');
            // "127" "000" "001" "022"
            foreach (string part in parts)
            {
                string trimmed = part.TrimStart('0');
                // "127" "" "1" "22"
                string corrected = trimmed.Length == 0 ? "0" : trimmed;
                // "127" "0" "1" "22"
                result += result.Length == 0 ? corrected : "." + corrected;
                // "127.0.1.22"
            }
            Label1.Text = result;
        }
    }
}
