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