Using CheatSheets To Apply Best Practices

Cheatsheet: V language

Cheatsheet: V language

1.1 V Conversion

Name Comment
Convert string to int i, _ := strconv.ParseInt(“12345”, 10, 64)
Convert string to int i, err := strconv.Atoi(“-42”)
Convert string to list L := strings.Split(“hi,v”, “”)
Convert string to []byte []byte("abcXX")
Convert string to float32 f, _ := strconv.ParseFloat(“3.1415”, 32)
Convert int to float32 0.5*float32(age)+7>= float32(age2)
Convert int to string s := strconv.Itoa(-42)
Convert rune to string string(rune1)
Convert list to string strings.Join(list, ", ")
Convert list to byte byteI := byte(65)
Convert byte to int int(byte('a'))
Convert byte to string string(byte('a'))
Convert bytes to string string([]byte("abcXX"))
Convert int32 to int32 Pointer func int32Ptr(i int32) *int32 { return &i }
Convert string[] to string strings.Join([]string{"a", "b"}, ",")
Format string fmt.Sprintf("At %v, %s", e.When, e.What)
Format string fmt.Printf("int: %d, float: %f, bool: %t\n", 123, 78.9, true)


Leave a Reply

Your email address will not be published. Required fields are marked *