Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 |
Tags
- JavaScript
- range
- channel
- Sync
- FOR
- Python
- tcp
- go
- write
- bitcoin
- Close
- GO 언어
- 리뷰
- window
- install
- Callback
- http
- C
- go언어
- 영화
- package
- mutex
- c++
- File
- 책
- API
- Linux
- windows
- json
- Golang
Archives
- Today
- Total
목록to (1)
Code Habit
go ) []byte to string
go 언어에서 byte배열을 string으로 변환하는 방법은 여러가지 있다. 예제이다. 1 2 3 4 5 6 7 8 9 10 11 12 13 b := []byte{'J', 'i', 'n', 'S', 'u', 'n', 'g'} str1 := string(b[:]) str2 := fmt.Sprintf("%s", buf) str3 := bytes.NewBuffer(b).String() str4 := BytesToString(b) // func BytesToString(b []byte) string { bh := (*reflect.SliceHeader)(unsafe.Pointer(&b)) sh := reflect.StringHeader{bh.Data, bh.Len} return *(*string)(unsafe...
카테고리 없음
2020. 9. 7. 22:44