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

php - Invalid Cofiguration - yii\base\InvalidConfigException - Yii2 -

How to show in django cms breadcrumbs full path? -

ruby on rails - npm error: tunneling socket could not be established, cause=connect ETIMEDOUT -