3
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

テキストをうんこにするアプリつくった

Last updated at Posted at 2021-08-16

背景

テキストをうんこにしたいことってよくありますよね
そんなときにサクッと使えるツールが見当たらなかったので自分で作ってみました

実物

うんこ製造機(GitHub Pages)

これが
before.png

こうなります
after.png

解説

charCode 取得して4進数に変換して4文字当てはめてるだけ
うんこだけじゃうんこすぎるので4文字なら何でもいけるようにしました

サロゲートペア使う文字の場合どうしようか考えたけど、
今回は JavaScript の仕様に上手くハマった

test.js

console.log("💩".length);	// 2
console.log("💩".charCodeAt(0).toString(16));	// "d83d"
console.log("💩".charCodeAt(1).toString(16));	// "dca9"

3
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?