Created
February 22, 2022 05:49
-
-
Save nidhi-canopas/46511ce5f74853e70d72b3c956b7b662 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import ( | |
| "fmt" | |
| "strings" | |
| "strconv" | |
| ) | |
| func main() { | |
| result := ConvertSliceToString([]int{10, 20, 30, 40}) | |
| fmt.Println("Slice converted string : ", result) | |
| } | |
| func ConvertSliceToString(input []int) string { | |
| var output []string | |
| for _, i := range input { | |
| output = append(output, strconv.Itoa(i)) | |
| } | |
| return strings.Join(output, ",") | |
| } | |
| output: | |
| Slice converted string : 10,20,30,40 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment