public void ChangeIncorrectData() { if (!char.IsUpper(Name[0])) { Name = Name.Remove(1, Name.Length - 1).ToUpper() + Name.Remove(0, 1); } if (!char.IsUpper(Surname[0])) { Surname = Surname.Remove(1, Surname.Length - 1).ToUpper() + Surname.Remove(0, 1); } if (Phone.Length > 17) { Phone = Phone.Remove(17); } if (Phone.Length < 17) { int dx = 17 - Phone.Length; var addStr = new string('x', dx); Phone = Phone.Replace(Phone, Phone + addStr); } if (Passport.Length > 9) { Passport = Passport.Remove(9); } if (Passport.Length < 9) { int dx = 9 - Passport.Length; var addStr = new string('0', dx); Passport = Passport.Insert(Passport.Length, addStr); } }