C#_ take random characters

Source: Internet
Author: User
Tags alphanumeric characters

1. Multi-digit alphanumeric characters, each value 0-9a-z

1     /// <summary>2     ///gets the next sequential code based on the previous (alphanumeric combination)3     /// </summary>4     /// <param name= "str" >Previous sequence Code</param>5     /// <returns></returns>6      Public Static stringEsequencecode (stringcode)7     {8         if(string. Isnullorwhitespace (code))9         {Ten             return ""; One         } ACode =code. ToUpper (); -         intMax = -;intMin = -; -         //Array 48-57 English 65-90 (uppercase)/97-122 (lowercase) the         Char[] STRs =code. ToCharArray (); -ASCIIEncoding ASCII =Newasciiencoding (); -          for(inti = STRs. Length-1; I >-1; i--) -         { +             intASCII = ASCII. GetBytes (Strs[i]. ToString ()) [0]; -             intAsciinew = (ASCII = = Max min: ASCII + (ASCII = = $?8:1))); +             byte[] ByteArray =New byte[] { (byte) asciinew}; AStrs[i] =Convert.tochar (ASCII. GetString (ByteArray)); at             if(AscII! =max) -             { -                  Break; -             } -         } -         return string. Join ("", STRs); in}
View Code

C#_ take random characters

Related Article

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.