Syed Abeed

Syed Abeed

26 Articles Published

Articles by Syed Abeed

26 articles

Python – numpy.meshgrid

Syed Abeed
Syed Abeed
Updated on 26-Mar-2026 992 Views

numpy.meshgrid() is used to create coordinate matrices from coordinate vectors. It's particularly useful for creating grids for plotting, evaluating functions over 2D domains, and mathematical computations that require coordinate pairs. Syntax numpy.meshgrid(*xi, **kwargs) Parameters Meshgrid can accept the following parameters − x1, x2, …, xn − It represents the coordinates of a grid. indexing − It is an optional parameter which defines the Cartesian 'xy' by default and matrix 'ij' index of output. sparse − It is an optional parameter. If we like ...

Read More

Python – numpy.geomspace

Syed Abeed
Syed Abeed
Updated on 26-Mar-2026 669 Views

numpy.geomspace() returns a set of numbers spaced evenly on a log scale (a geometric progression). This function is useful for creating exponentially spaced arrays where each element is a constant multiple of the previous one. Key differences from similar functions ? Linspace − Creates linearly spaced numbers between two endpoints Logspace − Creates logarithmically spaced numbers using base and power endpoints Geomspace − Creates geometrically spaced numbers using actual start and stop values Syntax numpy.geomspace(start, stop, num=50, endpoint=True, dtype=None) Parameters The above function accepts the following parameters ? ...

Read More

How to use ContainsAny() function in Golang?

Syed Abeed
Syed Abeed
Updated on 14-Mar-2022 996 Views

Golang has a built-in string function called ContainsAny() that we can use to check whether a specified string is present in a given string or not.ContainsAny() is completely different from Contains().Contains() is used to detect if a string contains a substring.ContainsAny() is used to detect if a string contains any characters in the provided string. Even if one character of the specified string is present in the original given string, then it returns True, else False.Syntaxfunc ContainsAny(s, chars string) boolWhere, s – Original Stringchars string – Substring where we define the string or characters.It returns a Boolean value.ExampleContainsAny() is case-sensitive, ...

Read More

How to convert a string into Title Case in Golang?

Syed Abeed
Syed Abeed
Updated on 10-Mar-2022 5K+ Views

Title() is a built-in function of strings package in Golang that is used to convert a string into Title Case. It converts the first character of each word in a given string into uppercase and returns the modified string.Syntaxfunc Title(s string) stringWhere s is the given string.Example 1Let us consider the following example −package main import (    "fmt"    "strings" ) func main() {    // Intializing the Strings    m := "title string function"    n := "Golang string package fUNCTION"    // Display the Strings    fmt.Println("String 1:", m)    fmt.Println("String 2:", n)    // ...

Read More

strings.SplitAfter() Function in Golang

Syed Abeed
Syed Abeed
Updated on 10-Mar-2022 2K+ Views

strings.SplitAfter() is a built-in function in Golang that is used to break a string into a slice. SplitAfter is different from other Split functions. Here, we slice a given string into substrings after each instance of separators and it returns a slice of those substrings.Syntaxfunc SplitAfter(S String, sep string) []stringWhere s is the given string and sep is the separator string.Example 1Consider the following example −package main import (    "fmt"    "strings" ) func main() {    // Intializing the Strings    x := "Golang Program of SplitAfter Function"    y := "1.2.3.4.5.6.7.8"        // Display the ...

Read More

Golang – strings.SplitN()

Syed Abeed
Syed Abeed
Updated on 10-Mar-2022 1K+ Views

strings.SplitN() is a built-in function in Golang that is used to split a given string into substrings by the given separator. It returns the slices of the substrings between those separators.Syntaxfunc SplitN(str, sep string, n int) []stringWhere, str is the given input string, sep is the separator string, andn defines the number of substrings that is to be returned.Example 1Consider the following example −package main import (    "fmt"    "strings" ) func main() {    // Intializing the Strings    p := "1, 2, 3, 4, 5, 6, 7"    q := "Welcome to Golang Programming Language"    r := ...

Read More

How to repeat a string for a specified number of times in Golang?

Syed Abeed
Syed Abeed
Updated on 10-Mar-2022 3K+ Views

strings.Repeat() is a built-in function in Golang that is used to repeat a string for a specified number of times. It returns a new string which consists of a new count of copies of the given string.SyntaxIts syntax is as follows −func Repeat(s string, count int) stringWhere s is the given string and count represents how many times you want to repeat the string. It returns a new string.Example 1The following example demonstrates how you can use the Repeat() function −package main import (    "fmt"    "strings" ) func main() {    // Initializing the Strings    x := ...

Read More

How to find the last index value of a string in Golang?

Syed Abeed
Syed Abeed
Updated on 10-Mar-2022 4K+ Views

LastIndex() is a built-in function of strings package in Golang. This function is used to check the index of the last occurrence of a specified substring in a given original string. If the substring is found in the given string, then it returns its index position, starting from 0; otherwise it returns "-1".SyntaxThe syntax of LastIndex() is −func LastIndex(str, substr string) intWhere, str is the string inside which we need to search, andsubstr is the substring that we want to search inside the str.Example 1Let us consider the following example −package main import (    "fmt"    "strings" ) func ...

Read More

strings.IndexByte() Function in Golang

Syed Abeed
Syed Abeed
Updated on 10-Mar-2022 392 Views

IndexByte() is an inbuilt function of strings package in Golang. This function returns the index of the first occurrence of a character in a given string. If the character is found, then it returns its index, starting from 0; else it returns "-1".Syntaxfunc IndexByte(str string, chr byte) intWhere, str – It is the original string.chr – Character (byte) to be checked in the string.Example 1Let us consider the following example −package main import (    "fmt"    "strings" ) func main() {    // Initializing the Strings    m := "IndexByte String Function"    n := "Golang IndexByte String Package" ...

Read More

strings.IndexAny() Function in Golang

Syed Abeed
Syed Abeed
Updated on 10-Mar-2022 468 Views

strings.IndexAny is a built-in function in Golang which is used to get the index of the first instance of any Unicode code point from the input substring. If the substring is found, it returns the position starting from 0; else it returns -1.Syntaxfunc IndexAny(s, chars string) intWhere, s – The original given string.chars – It is the substring that is to be checked in the given string.Example 1Take a look at the following example.package main import (    "fmt"    "strings" ) func main() {    // Defining the Variables    var str string    var charstring string    var ...

Read More
Showing 1–10 of 26 articles
« Prev 1 2 3 Next »
Advertisements