golang sort slice of strings
package main
import (
"fmt"
"sort"
)
func main() {
// Step 1: Declare a slice of strings
strSlice := []string{"banana", "apple", "orange", "grape"}
// Step 2: Use the sort.Strings function to sort the slice
sort.Strings(strSlice)
// Step 3: Print the sorted slice
fmt.Println("Sorted Slice:", strSlice)
}