SStringUtil.js 802 B

12345678910111213141516171819202122232425262728293031323334353637
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", { value: true });
  3. exports.SStringUtil = void 0;
  4. var SStringUtil = (function () {
  5. function SStringUtil() {
  6. }
  7. SStringUtil.num2Hex = function (n, len) {
  8. if (len === void 0) { len = 2; }
  9. var hex = "";
  10. var numStr = [
  11. "0",
  12. "1",
  13. "2",
  14. "3",
  15. "4",
  16. "5",
  17. "6",
  18. "7",
  19. "8",
  20. "9",
  21. "a",
  22. "b",
  23. "c",
  24. "d",
  25. "e",
  26. "f"
  27. ];
  28. while (len > 0) {
  29. hex = numStr[n & 0x0f] + hex;
  30. n = n >> 4;
  31. len--;
  32. }
  33. return hex;
  34. };
  35. return SStringUtil;
  36. }());
  37. exports.SStringUtil = SStringUtil;