Found 26504 Articles for Server Side Programming

Golang Program to pad a string with 0's on the right side

Akhil Sharma
Updated on 17-Feb-2023 15:11:31

2K+ Views

In the Go programming language, strings are a built-in data type that represents sequences of characters. They are defined using double quotes (") and can contain any valid Unicode characters. In this article we will write a go language program to pad a string with 0 on the right side of it. Method 1: Using User-defined function In this method , We are going to creating an external function. The function accepts the string to be padded along with the length as argument and returns the final string after adding zeroes to right of it. Algorithm Step 1 − ... Read More

Golang Program to compare two strings by ignoring case

Akhil Sharma
Updated on 17-Feb-2023 15:09:44

2K+ Views

In the Go programming language, strings are a built-in data type that represents sequences of characters. They are defined using double quotes (") and can contain any valid Unicode characters. In this article we will write a go language program to compare two strings by ignoring their case. Here, we will use both for loops and inbuilt library functions defined in go language to implement the result. Syntax func ToLower(r rune) rune ToLower() function present in unicode package is used to convert a given string to lowercase. It takes the rune character as an argument and returns a rune ... Read More

Golang Program to check a string starts with a specified substring

Akhil Sharma
Updated on 17-Feb-2023 15:07:18

772 Views

In the Go programming language, strings are a built-in data type that represents sequences of characters. They are defined using double quotes (") and can contain any valid Unicode characters. A substring is a portion of a string that contains a sequence of characters from the original string. A substring can be obtained in Go by using the slicing syntax on a string value. In this article we will write a go language program to check whether a string starts with a specified substring or not. Here, we will use both for loops and in built functions in go programming ... Read More

Python Program to check if the tuple is empty

Harshit Sachan
Updated on 17-Feb-2023 14:28:34

3K+ Views

In Python, it is often necessary to check if a tuple is empty in order to determine what actions to take in a program. A tuple in python is a pre-defined datatype that stores heterogeneous data, data of different types, in a single variable. The items can be indexed for further operations and python provides a wide array of methods to work upon them. They are immutable by nature which means we cannot make changes after we have created a tuple. This is whenever we perform some operation on the tuple a new tuple with resulting values is created. ... Read More

Golang Program to trim a string from the right side

Akhil Sharma
Updated on 17-Feb-2023 15:06:09

2K+ Views

Strings are a built-in data type that represents sequences of characters in Golang. They are defined using double quotes (") and can contain any valid Unicode characters. In this article we will write a go language program to trim a string from the right side. We will achieve this both by using for loop and inbuilt library functions present in go language. Method 1: Using User-defined function In this method, the for loop is used to iterate over the string and then it compares the character of the string to the character from the right side to be removed. If ... Read More

Python Program to add elements to a Tuple

Harshit Sachan
Updated on 17-Feb-2023 14:27:44

3K+ Views

In Python, tuples are immutable, meaning that once they are created, their elements cannot be modified. However, there may be times when you need to add elements to a tuple. In this article, we will be discussing how to add elements to a tuple in Python. We will go over the syntax for adding elements to a tuple and will provide examples of how to do so. Python tuples are very similar to Python lists, in that you can perform all the various operations that can be performed on lists. The only difference is that tuples cannot be modified after ... Read More

Golang Program to convert a string into Uppercase

Akhil Sharma
Updated on 17-Feb-2023 15:04:56

4K+ Views

Strings are a built-in data type that represents sequences of characters in Golang. They are defined using double quotes (") and can contain any valid Unicode characters. In this article we will write a go language program to convert a string to uppercase. Here we will see the usage of both for loop and library functions to carry on the respective conversion. Method, 1: Using user-defined function In this method, we are going to create a user-defined function to convert a string into upper-case. The Steps to perform that are explained below − Algorithm Step 1 − First, we ... Read More

Golang Program to trim a string from both sides

Akhil Sharma
Updated on 17-Feb-2023 15:03:34

4K+ Views

Strings are a built-in data type that represents sequences of characters in Golang. They are defined using double quotes (") and can contain any valid Unicode characters. In this article we are going to learn about how to trim a string from both side using Go programming language. Method 1: By Using A For Loop In this method, the for loop is used to iterate over the string and then it compares the character of the string to the character of the string. If they are equal then remove that character from the string and print the remaining string. Algorithm ... Read More

Golang Program to pad a string with 0's on left side

Akhil Sharma
Updated on 17-Feb-2023 15:02:10

3K+ Views

In the Go programming language, strings are a built-in data type that represents sequences of characters. They are defined using double quotes (") and can contain any valid Unicode characters. In this article, we are going to learn different techniques to pad a string with 0’s on the left side. Method 1: Using User-defined function In this method, we will achieve this by creating an external function. The function accepts the string to be padded along with the length as argument and returns the final string after adding zeroes to left of it. Algorithm Step 1 − First, we ... Read More

Python Program to add element to first and last position of linked list

Harshit Sachan
Updated on 17-Feb-2023 15:26:42

514 Views

In Python, a linked list is a linear data structure that consists of a chain of nodes, where each node contains a value and a reference to the next node in the chain. In this article, we will be discussing how to add an element to the first and last position of a linked list in Python. Linked List in Python A linked list is a referential data structure that holds a group of elements. it is similar in terms of an array but while the data is stored in contiguous memory location in an array, in linked ... Read More

Advertisements