Strings & Formatting (Printf, strings Package, Slicing) - Go Tutorial for Beginners #3
6views
004:35
T
Taught by Celeste AI - AI Coding Coach
View on YouTubeDescription
Learn how to work with strings and formatting in Go! ๐
In this lesson, you will learn:
โ
String literals and raw strings
โ
String concatenation with +
โ
Printf format verbs (%s, %d, %f, %v, %T)
โ
The strings package (ToUpper, ToLower, Split, Join)
โ
String indexing and slicing
๐ Timestamps:
0:00 - Introduction
0:24 - String Basics & Concatenation
1:03 - Printf Formatting
1:42 - strings Package
2:27 - String Indexing & Slicing
3:09 - Recap
3:39 - End
๐ป Source Code: https://github.com/GoCelesteAI/go_strings
๐ Code from this lesson:
// String concatenation
greeting := "Hello"
name := "World"
message := greeting + ", " + name + "!"
// Printf formatting
fmt.Printf("Name: %s\n", name)
fmt.Printf("Age: %d years\n", age)
fmt.Printf("Price: $%.2f\n", price)
fmt.Printf("Type: %T, Value: %v\n", age, age)
// strings package
strings.ToUpper("hello") // "HELLO"
strings.TrimSpace(" hi ") // "hi"
strings.Split("a,b,c", ",") // ["a", "b", "c"]
strings.Join(slice, "-") // "a-b-c"
// String slicing
word := "Golang"
word[0] // 'G' (first character)
word[:2] // "Go" (first 2)
word[2:] // "lang" (from index 2)
word[1:5] // "olan" (middle portion)
๐ Previous: Lesson 2 - Variables & Types
๐ Next: Lesson 4 - Numbers & Math
#Go #Golang #GoTutorial #LearnGo #Programming #Strings #Printf #Formatting #GoProgramming
Back to tutorials๐ Read the articleOpen in YouTube
Duration
4:35
Published
January 25, 2026
Added to Codegiz
March 15, 2026