How to realize string homoaddress inversion in golang
It is believed that many inexperienced people are at a loss about how to realize the reverse of string co-address in golang. Therefore, this paper summarizes the causes and solutions of the problem. Through this article, I hope you can solve this problem.
Demo
Package mainimport "fmt" func main () {str: = "map.baidu.com" fmt.Println (str) arr: = [] rune (str) for I, j: = 0, len (arr)-1; I < j I, j = arr 1, arr 1 {arr [I], arr [j] = arr [j], arr [I]} fmt.Println (string (arr), & arr [0]) for I, j: = 0,0; j < len (arr); for + {if string (arr [j]) = = "." {for n, m: = I, arr 1 N < m; n, m = naugh1, mmur1 {arr [n], arr [m] = arr [m], arr [n]} I = juni1} else if juni1 = = len (arr) {for n, m: = I, j; n < m N, m = nong1, arr 1 {arr [n], arr [m] = arr [m], arr [n]} fmt.Println (string (arr), & arr [0])}
Output
Liqiongtao:test liqiongtao$ go run main.go map.baidu.commoc.udiab.pam 0xc000090000com.baidu.map 0xc000090000, after reading the above, have you mastered the method of how to reverse the same address of a string in golang? If you want to learn more skills or want to know more about it, you are welcome to follow the industry information channel, thank you for reading!