Skip to content

Instantly share code, notes, and snippets.

@rsxdalv
Last active June 19, 2018 06:24
Show Gist options
  • Save rsxdalv/bc6d82246b7c13bec7f1b88ea155c39f to your computer and use it in GitHub Desktop.
Save rsxdalv/bc6d82246b7c13bec7f1b88ea155c39f to your computer and use it in GitHub Desktop.
JS-string-to-css-charcodes
const x = 'ievelc šeit'
console.log(
Array(x.length).fill(0).map((_, i) =>
`\${Number(
x.charCodeAt(i)
).toString(16).padStart(4, 0)}`
).join("")
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment