Javascript helper function that replaces regular characters of a string with their respective unicode's 「Fullwidth Form 」 characters
Reference: https://symbl.cc/en/unicode/blocks/halfwidth-and-fullwidth-forms/#overview
textRegular = "Sphinx Of Black Quartz - Judge My Vow";
textFW = replaceWithFullwidthChars(txt)
// 'Sphinx Of Black Quartz - Judge My Vow'
textFW2 = replaceWithFullwidthChars(txt.toUpperCase()).split("").join(" ")
// 'S P H I N X O F B L A C K Q U A R T Z - J U D G E M Y V O W'
const infix = replaceWithFullwidthChars("', '");
const prefix = replaceWithFullwidthChars("['");
const suffix = replaceWithFullwidthChars("']");
const textFW3 = [
prefix,
...replaceWithFullwidthChars("86753-89").split("").join(infix),
suffix
].join("");
// '['8', '6', '7', '5', '3', '-', '8', '9']'
Plus an confirm()
to select between the generated FW string, or that FW string but uppercase and with spaced characters:
const txtIn = prompt("Input text to FW")
const txtFw = replaceWithFullwidthChars(txtIn)
const txtFw2 = replaceWithFullwidthChars(txtIn.toUpperCase()).split("").join(" ")
const is1 = confirm(`🆗:\n${txtFw}\n\n🚫:\n${txtFw2}`)
document.body.focus();
oldFocus.focus();
setTimeout(() => {
try {
navigator.clipboard.writeText(is1 ? txtFw : txtFw2)
} catch (e) {
alert(`❌ Failed:\n${e}`)
}
}, 50)