{"id":1746,"date":"2020-03-16T21:13:34","date_gmt":"2020-03-16T21:13:34","guid":{"rendered":"https:\/\/golangbyexamples.com\/?p=1746"},"modified":"2020-03-16T21:13:50","modified_gmt":"2020-03-16T21:13:50","slug":"swap-two-strings-in-golang","status":"publish","type":"post","link":"https:\/\/golangbyexamples.com\/swap-two-strings-in-golang\/","title":{"rendered":"Swap two strings in Golang"},"content":{"rendered":"\n
GO provides a very neat way of swapping of two strings. See below program<\/p>\n\n\n\n
package main\n\nimport \"fmt\"\n\nfunc main() {\n a := \"123\"\n b := \"xyz\"\n fmt.Printf(\"Before a:%s b:%s\\n\", a, b)\n a, b = b, a\n fmt.Printf(\"After a:%s b:%s\\n\", a, b)\n}<\/code><\/pre>\n\n\n\nOutput:<\/strong><\/p>\n\n\n\nBefore a:123 b:xyz\nAfter a:xyz b:123<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"GO provides a very neat way of swapping of two strings. See below program Output:<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"spay_email":"","footnotes":"","jetpack_publicize_message":"","jetpack_is_tweetstorm":false},"categories":[1],"tags":[],"class_list":["post-1746","post","type-post","status-publish","format-standard","hentry","category-tech"],"yoast_head":"\n
Swap two strings in Golang - Welcome To Golang By Example<\/title>\n\n\n\n\n\n\n\n\n\n\n\n\n\n\t\n