ZhangZhihui's Blog  

2023年10月7日

摘要: To take out the first element of the slice: numbers := []int{3, 14, 159, 26, 53, 58} numbers = numbers[1:] // remove element 0 To take out the last el 阅读全文
posted @ 2023-10-07 22:58 ZhangZhihuiAAA 阅读(12) 评论(0) 推荐(0)
 
摘要: There is no built-in function for insertion, but you can still use append for the task. Let’s say you want to insert the number 1000 between elements 阅读全文
posted @ 2023-10-07 22:50 ZhangZhihuiAAA 阅读(30) 评论(0) 推荐(0)
 
摘要: Problem: You want to define metadata to describe the struct fields. Solution: Use struct tags to define metadata and the reflect package to access the 阅读全文
posted @ 2023-10-07 22:32 ZhangZhihuiAAA 阅读(18) 评论(0) 推荐(0)
 
摘要: Problem: You want to create an instance of a struct. Solution: Create a struct instance directly using the name of the struct, or a pointer to a struc 阅读全文
posted @ 2023-10-07 11:28 ZhangZhihuiAAA 阅读(8) 评论(0) 推荐(0)