hexSpace

Converts hex with spaces

Created by: hackvertor
Installed 1 times

Viewed: 36

Category: Convert

Created on: Tuesday, October 8, 2024 at 8:39:48 PM

Updated on: Sunday, May 25, 2025 at 5:29:45 PM

This is a built in tag
Tag arguments
[]
Code
class hexSpace {
  encode(input) {
    return input
      .split("")
      .map((chr) => chr.codePointAt(0).toString(16).padStart(2, "0"))
      .join(" ");
  }

  decode(input) {
    return input
      .split(" ")
      .map((c) => String.fromCodePoint(parseInt(c, 16)))
      .join("");
  }
  matches(input){
    return /^([a-f0-9]{2}\s?)+/i.exec(input)
}
}