Overview strings package of GO provides a ReplaceAll method that can be used to replace all non-overlapping instances of a given substring with a new substring. We can use this method to…
Category: Tech
Find and delete a character in string in Go (Golang)
Overview strings package of GO provides a ReplaceAll method that can be used to replace all non-overlapping instances of a given substring with a new substring. We can use this method to…
Find and delete in a array in Go (Golang)
There can be two cases: Modify Original Array Keep copying to the original array skipping the item which needs to be deleted Reslice at the end Output: Do not modify the original…
Find and delete in a slice in Go (Golang)
There can be two cases: Modify Original Slice Keep copying to the original slice skipping the item which needs to be deleted Reslice at the end Output: Do not modify the original…
Reverse a string in Go (Golang)
In Golang string is a sequence of bytes. A string literal actually represents a UTF-8 sequence of bytes. In UTF-8, ASCII characters are single-byte corresponding to the first 128 Unicode characters. All other…
Swap two strings in Golang
GO provides a very neat way of swapping of two strings. See below program Output:
Swap Characters of a string in Go (Golang)
In Golang string is a sequence of bytes. A string literal actually represents a UTF-8 sequence of bytes. In UTF-8, ASCII characters are single-byte corresponding to the first 128 Unicode characters. All other…
All permutations of a string in Golang
In Golang string is a sequence of bytes. A string literal actually represents a UTF-8 sequence of bytes. In UTF-8, ASCII characters are single-byte corresponding to the first 128 Unicode characters. All other…
Index character in a string in Go (Golang)
In Golang string is a sequence of bytes. A string literal actually represents a UTF-8 sequence of bytes. In UTF-8, ASCII characters are single-byte corresponding to the first 128 Unicode characters. All other…
Find the index of the last instance of a substring in Go (Golang)
Overview In GO string are UTF-8 encoded. strings package of GO provides a LastIndex method that can be used to get the index of the last occurrence of a substring in a…