(camel string)
| 58 | } |
| 59 | |
| 60 | func SnakeCase(camel string) string { |
| 61 | var buf bytes.Buffer |
| 62 | for _, c := range camel { |
| 63 | if 'A' <= c && c <= 'Z' { |
| 64 | // just convert [A-Z] to _[a-z] |
| 65 | if buf.Len() > 0 { |
| 66 | buf.WriteRune('_') |
| 67 | } |
| 68 | buf.WriteRune(c - 'A' + 'a') |
| 69 | } else { |
| 70 | buf.WriteRune(c) |
| 71 | } |
| 72 | } |
| 73 | return buf.String() |
| 74 | } |
| 75 | |
| 76 | // Float32bits returns the IEEE 754 binary representation of f, |
| 77 | // with the sign bit of f and the result in the same bit position. |