LoginSignup
3
3

More than 5 years have passed since last update.

GoでNUL文字を出力

Posted at

Go言語では"\0"とやってもNUL文字が出力されないようです。
文字列の途中や最後にNUL文字を入れるには、

nulChar := string([]byte{0})
includeNul := strings.Join("hoge", nulChar, "huga")
//=> "hoge\0huga"

とするしか無い?
もっといい方法がないのだろうか…

3
3
2

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
3