LoginSignup
0
1

More than 5 years have passed since last update.

半角ハイフンのつらみ

Last updated at Posted at 2016-10-25

見た目にはほとんどわからないけど全部別物だしもちろんSQLやなんかの文字列比較にはヒットしないハイフンがこの世には多すぎるよ.
DBに混ざって入ってたりしたら大変だね.

自分が今いじってるDBには以下の4種類が入ってたよ. しばらく気付けなかったよ.

$ echo '-' | od -i
> 0000000                10                                                
> 0000001

$ echo '‐' | od -i
> 0000000         177242338                                                
> 0000004

$ echo '−' | od -i
> 0000000         177375458                                                
> 0000004

$ echo '—' | od -i
> 0000000         177504482                                                
> 0000004
0
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
0
1