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.

Basic string operations

Basic string operations - Go Tutorial

From the course: Learning the Go Standard Library

Start my 1-month free trial

Basic string operations

- All right. Let's start off by looking at some basic operations involving strings. So the documentation for the go strings package is located at this link. And I have it here on my browser. And if I scroll down a bit, you can see that there's a pretty fairly extensive collection of functions just within this one package. Now these are not all of the string related functions. There are some other packages that also work with strings. But this is where we'll get started. All right. So let's go ahead, back over to our code. All right. And here in the editor, I'm going to open up the basic start go file in my basic folder. So let's go ahead and uncomment our import statements. So I'm going to import FMT and strings and I'm also going to uncomment, oops, this string variable. So to calculate the length of a string or of any sequence for that matter, you can use the built-in length function. So I'm going to print out the…

Contents