Notice
Recent Posts
Recent Comments
Link
투케이2K
47. (Go Lang) [Mac Os] Go 문법 : string to byte 데이터 형 변환 수행 실시 - convert type 본문
Go Lang (Go 언어)
47. (Go Lang) [Mac Os] Go 문법 : string to byte 데이터 형 변환 수행 실시 - convert type
투케이2K 2024. 2. 22. 10:53[개발 환경 설정]
개발 언어 : Go

[소스 코드]
package main
import (
"fmt"
)
func main() {
// [초기 문자열 선언]
data := "hello"
// [string to byte 변환]
bytes := []byte(data)
// [byte to string 변환]
str := string(bytes)
// [로그 출력]
fmt.Println("")
fmt.Println("----------------------------------------------")
fmt.Println("[로그 출력 수행]")
fmt.Println("----------------------------------------------")
fmt.Println("bytes : ", bytes)
fmt.Println("----------------------------------------------")
fmt.Println("str : ", str)
fmt.Println("----------------------------------------------")
fmt.Println("")
}
[결과 출력]

반응형
'Go Lang (Go 언어)' 카테고리의 다른 글
Comments