From the course: Learning the Go Standard Library
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
String manipulation - Go Tutorial
From the course: Learning the Go Standard Library
String manipulation
- [Instructor] All right, in this example, we're going to see how to perform some string manipulation with Go. So these functions typically are used to modify the contents of strings or create new strings from existing ones. So we're going to open up our code and that's going to be in the start folder in manipulation and we'll open up our file here. So let's start with the split and join functions. So the split function is used to split a string into sub strings. And it does this based on the boundary string given as the second parameter. So for the first example, let's uncomment our string S here then let's split the string in S on spaces. So I'll write sub one and we'll assign that the value of strings.split and we're going to split S on spaces, right. And I'm going to have to import fmt and strings. All right. And then we'll just print out the results and I'll use print F for this and I'm going to use the Q…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
(Locked)
The strings package1m 31s
-
(Locked)
Basic string operations7m 34s
-
(Locked)
String searching7m 13s
-
(Locked)
String manipulation9m 46s
-
(Locked)
Using the Map function6m 52s
-
(Locked)
Using string builder6m 18s
-
(Locked)
Parsing strings with strconv9m 11s
-
(Locked)
String tests with Unicode5m 16s
-
(Locked)
-
-
-
-