- Trending Categories
- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Found 1082 Articles for Go Programming
638 Views
String in Golang is a collection of characters. Since strings in Go are immutable, they cannot be modified after they have been produced. Concatenating or adding to an existing string, however, enables the creation of new strings. The frequency of a character means the number of times a character is appearing. Syntax map() To keep track of how frequently each character appears in the input string, the built-in map data structure in Go is used in example below. The map is an unsorted collection of key-value pairs with unique keys and variable types of values for the values. func ... Read More
7K+ Views
A string in Golang is a collection of characters. Since strings in Go are immutable, they cannot be modified after they have been produced. Concatenating or adding to an existing string, however, enables the creation of new strings. A built-in type in Go, the string type can be used in a variety of ways much like any other data type. Syntax func len(v Type) int The len() function is used to get the length of any parameter. It takes one parameter as the data type variable whose length we wish to find and returns the integer value which is ... Read More
5K+ Views
A string in Golang is a collection of characters. Since strings in Go are immutable, they cannot be modified after they have been produced. Concatenating or adding to an existing string, however, enables the creation of new strings. A built-in type in Go, the string type can be used in a variety of ways much like any other data type. Syntax strings.Join(words, ” ”) A slice of strings can be joined together with a separator using the join method. Two arguments are required by the function: a slice of strings, and a separator string. It gives back a single ... Read More
92 Views
A string in Golang is a collection of characters. Since strings in Go are immutable, they cannot be modified after they have been produced. Concatenating or adding to an existing string, however, enables the creation of new strings. A built-in type in Go, the string type can be used in a variety of ways much like any other data type. Syntax rand.Seed(value) Rand.Seed() function is used to generate random numbers. It takes a user input as argument which is the upper limit for generating random numbers. func Now() Time The Now() function is defined in time package. this ... Read More
968 Views
When a string buffer is cleared, all of the data that was previously stored inside the buffer is deleted. This can be done for a variety of reasons, including when you want to reuse the buffer for fresh data or when the data that is currently in the buffer is no longer required. Here we will understand different techniques of clear a string buffer using go programming language Syntax Reset() Any accumulated data is discarded and the buffer is reset to zero using the Reset() method. The old buffer is essentially replaced with a new one and the old ... Read More
504 Views
A substring is a small string in a string and string in Golang is a collection of characters. Since strings in Go are immutable, they cannot be modified after they have been produced. Concatenating or adding to an existing string, however, enables the creation of new strings. A built-in type in Go, the string type can be used in a variety of ways much like any other data type. Syntax strings.Contains(str, substring string) To determine whether a string contains a particular substring, use the Contains(s, substr string) bool function. If the substring is found in the supplied string, a ... Read More
233 Views
In Golang, data hiding is a practice of preventing external code from accessing or changing a class’s members. This is accomplished by designating the class's members as private, which restricts access to or modification of them to the class's methods only. This is a crucial idea in object-oriented programming since it ensures the data's integrity and the class's proper operation. Syntax struct A struct is a composite data type used in the Go programming language that enables you to bring together related values of various types, such as a collection of fields or a collection of methods. Similar to ... Read More
4K+ Views
In this article, we will see how to fetch maximum and minimum elements from a slice. A slice is a sequence of elements just like an array. An array is a fixed sequence of elements whereas a slice is a dynamic array, meaning its value is not fixed and can be changed. Slices are more efficient and faster than arrays moreover; they are passed by reference instead by value. Let us understand this basic concept using different set of examples and algorithms based upon them. Method 1: Using the Helper Function In this method, we will learn how to get ... Read More
4K+ Views
In this article, we will check if the slice is empty or not using a variety of examples. A slice is a sequence of elements just like an array. An array is a fixed sequence of elements whereas a slice is a dynamic array, meaning its value is not fixed and can be changed. Slices are more efficient and faster than arrays moreover they are passed by reference instead by value. Let’s learn through examples how it can be executed. Syntax func append(slice, element_1, element_2…, element_N) []T The append function is used to add values to an array slice. ... Read More
1K+ Views
In this article, we will see what are the ways to check whether two slices are equal or not with the help of relevant examples. A slice is a sequence of elements just like an array. An array is a fixed sequence of elements whereas a slice is a dynamic array, meaning its value is not fixed and can be changed. Slices are more efficient and faster than arrays moreover; they are passed by reference instead by value. Let us learn the concept through examples. Method 1: Using a built-in Function In this method, we will use reflect.DeepEqual() function from ... Read More