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 | 29 | 30 |
Tags
- json
- install
- Callback
- C
- API
- windows
- FOR
- Close
- package
- Golang
- Linux
- mutex
- GO 언어
- bitcoin
- range
- 영화
- write
- c++
- channel
- File
- go언어
- Sync
- go
- http
- tcp
- 책
- Python
- window
- 리뷰
- JavaScript
Archives
- Today
- Total
목록convert (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