Address creating function c# -


so, making school pizza program requests customer details such name phone number , address. want make customer have have number, space , letter when fill in address, have created method should error , tell customer address invalid, method not seem working well. please help

here codes current method:

public static string readaddress(string prompt) // didn't spell correctly     {         string userinput = " ";         bool success = false;          while (!success)         {             console.write(prompt);             try             {                 userinput = console.readline();                 if (userinput.length <= 70 && userinput.length > 8) //checks length of user input                 {                      success = true;     //assumes input correct                     bool letter = false;                     bool space = false;                     bool number = false;                      foreach (char character in userinput)                      {                         letter = char.isletter(character);                         space = char.iswhitespace(character);                         number = char.isnumber(character);                       }                     success = letter & space & number;                 }                 else                 {                     success = false; // enables loop exit                  }             }             catch (exception ex)             {                 console.writeline(ex.message);             }         }         return userinput;     } 

currently blocks when have number, space , letter.

if you've ever seen letter, want remember fact (ditto other character types).

 letter = letter || char.isletter(character); 

(also, know check annoy people no end since live in named house, no numbers)


Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

thorough guide for profiling racket code -