Golang Rune - Fully Understanding Runes in Go
Вставка
- Опубліковано 15 лип 2024
- Golang Rune - Fully Understanding Runes in Go -
In today's Golang tutorial video, we will talk about the basic runes in the Go/Golang programming language. We will go through the ASCII characters, UTF-8 in Go, and everything you need to know to fully understand how runes function in Golang. Enjoy!
--
Golang Dojo is all about becoming Golang Ninjas together. You can expect all kinds of Golang tutorials, news, tips & tricks, and my daily struggles as a Golang developer. Make sure to subscribe if you look forward to such content!
Get Your Golang Cheat Sheet! - golangdojo.com/cheatsheet
Git repos & notes - golangdojo.com/resources
Golang Explained - • Golang Rune - Fully Un...
--
Timestamps
0:00 Intro
0:33 ASCII characters
1:51 UTF-8
4:11 Single-byte characters
4:48 Multi-byte characters
5:17 Golang Runes
6:47 Strings and Bytes
10:15 Outro
--
#golang #goprogramming #golangdojo - Наука та технологія
📝Get your *FREE Golang Cheat Sheet* -
golangdojo.com/cheatsheet
So basically a rune is a 4byte utf 8 encoding used as default when declaring a character or string. If you want to use something more efficient like ascii encoding that uses only one byte or 7 bits I think? you can use the byte function in golang and type the decimal number into represented by binary. for example, byte(65) which is 1000001 I'm binary which represents "A" in ascii. Here you have "A" used in your program with ascii encoding (using 3 less bytes) instead of using default rune which is 4 byte representation for that character "A"
Love to see Go _!_
I also picked up Flutter/Dart this past couple years for App Development on Mobile & Desktop. Sh!t is Legend.
Let's get it :)
Amazing explanation about encoding schemes and then relate those to golang practically. Thanks for creating this kind of content
More to come!
Good work nice explanation
me gustan tus videos saludos desde MExico quiero aprender
Amazing content, really focused and thoroughly explained. Well done and thanks! Yes I subscribed 😊
→ 1 tip: Make the font of your IDE bigger. On my mobile phone it's really difficult (/ impossible) to read what you're typing.
Thanks for comment! Cool kid coding UI coming up for all future videos :)
Would not help people watching from a laptop. Seems to be your problem.
Awesome explanation! Also the audio quality is great.
Thanks boi :)
Thanks, waiting for more :)
More is indeed coming up!
I love your go languagu tutorialsu, pleasu upload some web developmentu videosu. sorry for the engrishu, its a jokeu
Nice bro, deep explanation. very nice!
Glad it helped!
You speak like an asian Christopher Walken haha.
Great video, I'm always looking for a Go dedicated channel, so: Subscribed!
I'd take that as a compliment, and welcome!
I love this video. Sadly it's kinda niche.
awesome explaination!! Just have one question why does the rune has length of 3bytes for chinese character? rune is supposed to be int32(4 bytes) 🤔
It is just the length calculation golang is doing which would seem fair as utf-8 would only store 3 bytes or we actually saving space in memory within the process itself?
Rune isn't the most memory efficient compared to string. The extra byte is kinda just wasted.
This is so nicely explained. But why use light mode, that is not acceptable 😆
Since Java 18 the default charset is UTF-8
please a video on struct
Coming up!
Thanks, but I've got a question... how the hell do you scan a rune??
How do I get the length of a string in the number of charcaters. What would happen if you take the 11th element of that string? That's just garbage information, it couldn't be resolved to a character that makes sense. How can I "foreach" across each character in a string?
How do I get the length of a string in the number of charcaters?
The only way I figured was turning the string into a rune slice - len([]rune("Hello 世界")) or use the foreach loop to count.
What would happen if you take the 11th element of that string?
It's going to return some ascii value depending how you print it out, unfortunately :(
How can I "foreach" across each character in a string?
You'd literally use a "foreach" loop in Golang -- for _, c := range "Hello 世界"
Hope this helps buddy :)
What IDE do you use?
That's Goland by JetBrain. Great IDE
GoFiber plz
Will eventually get to it!
wtf is this language for the first 8 seconds? wewewites wwiewieworld
mean