Skip to content

Instantly share code, notes, and snippets.

@zwpp
Created July 11, 2016 02:46
Show Gist options
  • Save zwpp/7d4acd874d8b7d536e31d67f1676714b to your computer and use it in GitHub Desktop.
Save zwpp/7d4acd874d8b7d536e31d67f1676714b to your computer and use it in GitHub Desktop.
Rubyで筆記体っぽい文字様記号に置き換えるコード例
#Script symbolsを使ったとき
str1 = str1.tr("A-Za-z", "\u{1D49C}-\u{1D4CF}")
str1 = str1.tr("\u{1D49D}\u{1D4A0}\u{1D4A1}\u{1D4A3}\u{1D4A4}\u{1D4A7}\u{1D4A8}\u{1D4AD}\u{1D4BA}\u{1D4BC}\u{1D4C4}",
"\u{212C}\u{2130}\u{2131}\u{210B}\u{2110}\u{2112}\u{2133}\u{211B}\u{212F}\u{210A}\u{2134}")
# Bold script symbolsを使ったとき
str2 = str2.tr("A-Za-z", "\u{1D4D0}-\u{1D503}")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment