Get the App
SLTechnology News&Howtos  ›  Internet Technology  › 

How to realize string homoaddress inversion in golang

Shulou Source: shulou.com Published: 2022-06-02 10:38:52 10月03日 Update

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!

Tags: Characters strings content methods more problems helplessness for this reason skills articles experience industry information information channels channels jackers + Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno macOS Xiaomi Linux Huawei Apple