GO language program with example of Array Reverse Sort Functions for integer and strings
Simple program using StringSlice, IntSlice functions to Reverse Sort an Array.
Example
/// GO language program with Array Reverse
package main
import (
"fmt"
"sort"
)
func main() {
fmt.Println("Interger Reverse Sort")
num := []int{50,90, 30, 10, 50}
sort.Sort(sort.Reverse(sort.IntSlice(num)))
fmt.Println(num)
fmt.Println()
fmt.Println("String Reverse Sort")
text := []string{"Japan","UK","Germany","Australia","Pakistan"}
sort.Sort(sort.Reverse(sort.StringSlice(text)))
fmt.Println(text)
}
Output
Interger Reverse Sort
[90 50 50 30 10]
String Reverse Sort
[UK Pakistan Japan Germany Australia]
Most Helpful This Week
Program in Go language to Find Largest Element of an Array
GO Program to Generate Multiplication Table
GO Hello World program
GO Program to take user input and addition of two strings
GO Program to find area and circumference of circle
Contains, ContainsAny, Count and EqualFold string functions in Go Language