Alphabetical sequence increment, i.e. A+1=b,b+2=d

Source: Internet
Author: User

The actual problem is the number 15001 order 15001-a automatically generated 15001-b,15001-c ....

//Description: Generate 15001-b with 15001-a as a benchmarkstringMaxno ="15001-a";//1. Separate the order number and suffixstring[] Strmax = Maxno. Split ('-');//split the string with '-' to separate 150001 and a//2. Convert ASCII code values to a char character string, convertCharSort = (Char) strmax[1][0];//strmax[1] Array 2nd element, Strmax[1][0] The first character of the 2nd element of an array//3. Convert to ASCII-corresponding numbers intASCII = (int) sort;//convert letter A to ASCII value//4. Serial number +1 intASCII2 = ASCII +1;//serial number plus 1, for the//5. Convert Back to letterstringSort2 = ((Char) (ASCII2). ToString ();//and convert to letter B .//6. Return the stitched string 15001-breturnstrmax[0] +"-"+ Sort2. ToString ();

Alphabetical sequence increment, i.e. A+1=b,b+2=d

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.