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

String manipulation - Go Tutorial

From the course: Learning the Go Standard Library

Start my 1-month free trial

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…

Contents