10-to-26-to-conversion (base for A-Z)-php Tutorial

Source: Internet
Author: User
10-to-26-to-A-Z conversion
10 hexadecimal to 26 hexadecimal (base for A-Z) conversion, the 10 hexadecimal number into a Z-A base for the 26 hexadecimal data.
Used to obtain the index of a specified column in excel

  1. /**
  2. * Obtain the name index of a specified unit in an excel table:
  3. * For example, 1st rows and 1st columns:
  4. * A1 is returned.
  5. * Column 2 of row 27th:
  6. * AA1 returned:
  7. *
  8. * @ Param int $ row
  9. * @ Param int $ column of col
  10. *
  11. * @ Author mingche
  12. * @ Since 2014-05-31
  13. */
  14. Function getExcelCeilIndex ($ row, $ col ){
  15. If ($ row> 0 & $ col> 0)
  16. {
  17. $ Str = "ZABCDEFGHIGKLMNOPQRSTUVWXY ";
  18. $ Col_str = "";
  19. Do
  20. {
  21. $ Col_tmp = $ col % 26;
  22. $ Col = $ col_tmp = 0? Intval ($ col/26)-1: intval ($ col/26 );
  23. $ Col_str = $ str [$ col_tmp]. $ col_str;
  24. } While ($ col );
  25. Return $ col_str. $ row;
  26. }
  27. Return false;
  28. }
  29. ?>

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.