fullWidth

This converts ascii characters into their full width forms.

Created by: hackvertor
Installed 1 times

Category: Convert

Created on: Wednesday, September 25, 2024 at 7:10:50 AM

Updated on: Wednesday, September 25, 2024 at 7:10:50 AM

This is a built in tag

Tag arguments
[]
Code
class fullWidth {
  encode(input) {
    return input
      .split("")
      .map((char) => {
        const code = char.charCodeAt(0);
        if (code >= 33 && code <= 126) {
          return String.fromCharCode(code + 0xfee0);
        }
        return char;
      })
      .join("");
  }
}