This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
x := “I’m so hungry right now.” | |
for i := 0; i < len(x); i++ { | |
fmt.Printf(“%-3v → %4d → %08b\n”, string(x[i]), x[i], x[i]) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
x := “Ó o auê aí, ô!” // Perfectly valid Portuguese. (Not really.) | |
for i := 0; i < len(x); i++ { | |
fmt.Printf(“%-3v → %4d → %8b\n”, string(x[i]), x[i], x[i]) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
s := “Ó o auê aí, ô!” | |
for len(s) > 0 { | |
char, size := utf8.DecodeRune([]byte(s)) | |
fmt.Printf(“%-2c → %3d → Size: %1v byte(s).\n”, char, char, size) | |
s = s[size:] | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// a + ~ = ã, right? | |
ã := []byte{97, 126} | |
fmt.Println(string(ã)) | |
// And can we spot a pattern of repeating separators? | |
x := “Ó o auê aí, ô!” | |
for _, v := range x { | |
fmt.Printf(“%v “, v) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
x := “aã香🤔” | |
for i := 0; i < len(x); i++ { | |
fmt.Printf(“%08b “, x[i]) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
a, _ := strconv.ParseInt(“00011100011”, 2, 64) | |
b, _ := strconv.ParseInt(“1001100110011001”, 2, 64) | |
c, _ := strconv.ParseInt(“000011111100100010100”, 2, 64) | |
fmt.Printf(“%x %x %x”, a, b, c) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
I → 73 → 01001001 | |
‘ → 39 → 00100111 | |
m → 109 → 01101101 | |
→ 32 → 00100000 | |
s → 115 → 01110011 | |
o → 111 → 01101111 | |
→ 32 → 00100000 | |
h → 104 → 01101000 | |
u → 117 → 01110101 | |
[…] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
à → 195 → 11000011 | |
→ 147 → 10010011 | |
→ 32 → 00100000 | |
o → 111 → 01101111 | |
→ 32 → 00100000 | |
a → 97 → 01100001 | |
u → 117 → 01110101 | |
à → 195 → 11000011 | |
ª → 170 → 10101010 | |
[…] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Ó → 211 → Size: 2 byte(s). | |
[…] | |
ê → 234 → Size: 2 byte(s). | |
[…] | |
í → 237 → Size: 2 byte(s). | |
[…] | |
ô → 244 → Size: 2 byte(s). | |
[…] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
a~ | |
211 32 111 32 97 117 234 32 97 237 44 32 244 33 |
OlderNewer