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