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