C# input validation, first digit must be 1? -


i want make sure user input 6 digits , start digit 1. how can make sure input start 1?

private static void getcustomerinfo(out string accnumberc)     {         string accnumberc;      console.write("account number: ");         accnumberc = console.readline();      if (accnumberc == "" || accnumberc.length < 6 || accnumberc.length > 6)         {             console.writeline("invalid data entered - no value redorded");             accnumberc = null;         }        } 

if (string.isnullorempty(accnumberc) || accnumberc.length != 6 || !accnumberc.startswith("1"))  {    console.writeline("invalid data entered - no value redorded"); } 

Comments

Popular posts from this blog

html - Difficulties with background-image property -

visual studio code - What does the isShellCommand property actually do and how should you use it? -

ios - Segue not passing data between ViewControllers -