2
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.

【Golang】Byte型

Posted at

#【Golang】Byte型
Golangの基礎学習〜Webアプリケーション作成までの学習を終えたので、復習を兼ねてまとめていく。 基礎〜応用まで。

package main
//バイト型
//ネットワーク系、ファイルの読み書き系で使われる

import "fmt"

func main() {
	//バイト型 アスキーコード
	//初期化
	b := []byte{72, 73}
	fmt.Println(b)
	//>>72,73

	//string() 文字列に変換
	fmt.Println(string(b))
	//>>HI
	
	//バイトのスライスに変換
	c := []byte("HI")
	fmt.Println(c)
	//>>72,73

	//文字列に変換
	fmt.Println(string(c))
	//>>HI
}
2
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
2
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?