Unity's Registry check (C #)

Source: Internet
Author: User

usingUnityengine;usingSystem.Collections; Public classUserregister:monobehaviour {voidStart () {} Public stringUsername ="";  Public stringPassword ="";  Public stringRepassword ="";  Public stringAge ="";  Public stringemail ="";  Public stringGender ="";  Public stringShowMessage ="";  Public voidOngui () {Guilayout.label (showmessage); Guilayout.label ("User name:");//User name (5-10-bit, can only have subtitles, numbers, _ composition, name only with SB two words)Username=Guilayout.textfield (username); Guilayout.label ("Password:");//(6-10-bit length)Password =Guilayout.textfield (password); Guilayout.label ("Repeat Password:"); Repassword=Guilayout.textfield (Repassword); Guilayout.label ("Age:");//1-100Age =Guilayout.textfield (age); Guilayout.label ("Email:");//have an @ ending with. com. net. cnemail =Guilayout.textfield (email); Guilayout.label ("Gender:");//male or femaleGender =Guilayout.textfield (gender);    Checkinput (); }    Private string[] Domainarray =New string[] {". com",". NET",". CN" }; Private voidCheckinput () {showmessage=""; if(Username = ="") {ShowMessage+="the user name cannot be empty \ n"; }        Else if(username. Length <5|| Username. Length >Ten) {ShowMessage+="user name is 5-10 bits \ n"; }        Else {             for(inti =0; I < username. Length; i++)            {                Charc =Username[i]; if(c >='a'&& C <'Z') || (C >'A'&& C <='Z') || (c >='0'&& C <'9') || (c = ='_'))                { }                Else{showmessage+="user name can only have subtitles, numbers, _ Composition \ n"; }            }            if(username. IndexOf ("SB") != -1) {ShowMessage+="There is no sensitive typeface in the username \ n"; }        }        if(Password. Length <6|| Password. Length >Ten) {ShowMessage+="password length is 6-10 bits \ n"; }        if(Repassword! =password) {ShowMessage+="two times the password for the input is inconsistent \ n"; }        intagetemp=0; if(!int. TryParse (age, outagetemp)) {ShowMessage+="age must enter a number \ n"; }Else {            if(Agetemp <=0|| Agetemp > -) {ShowMessage+="The age range must be 1-100\n"; }        }        if(email.) IndexOf ("@") == -1) {ShowMessage+="The format of the mailbox entry is not valid \ n"; }Else {            BOOLisright=false;  for(inti =0; i < domainarray.length; i++) {                if(email.) EndsWith (Domainarray[i])) {Isright=true; Break; }            }            if(!isright) {ShowMessage+="The format of the mailbox entry is not valid \ n"; }        }        if(Gender = ="male"|| Gender = ="female")        {        }        Else{showmessage+="gender must be filled in male or female"; }    }}

Unity's Registry check (C #)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.