{"id":1460,"date":"2020-02-23T11:45:57","date_gmt":"2020-02-23T11:45:57","guid":{"rendered":"https:\/\/golangbyexamples.com\/?p=1460"},"modified":"2020-02-23T11:46:02","modified_gmt":"2020-02-23T11:46:02","slug":"remove-all-white-spaces-string-golang","status":"publish","type":"post","link":"https:\/\/golangbyexamples.com\/remove-all-white-spaces-string-golang\/","title":{"rendered":"Remove or Strip all white spaces from a string in Go (Golang)"},"content":{"rendered":"\n
strings.ReplaceAll<\/strong> function can be used to trim all white spaces from a string in Golang. Below is the signature of the function<\/p>\n\n\n\n Working Code:<\/strong><\/p>\n\n\n\n Output:<\/strong><\/p>\n\n\n\n strings.ReplaceAll function can be used to trim all white spaces from a string in Golang. Below is the signature of the function s(first argument) is the input string old(second argument) is the…<\/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":[203,204],"class_list":["post-1460","post","type-post","status-publish","format-standard","hentry","category-tech","tag-all","tag-trim"],"yoast_head":"\nfunc ReplaceAll(s, old, new string) string<\/code><\/pre>\n\n\n\n
package main\n\nimport (\n \"fmt\"\n \"strings\"\n)\n\nfunc main() {\n sample := \" This is a sample string \"\n noSpaceString := strings.ReplaceAll(sample, \" \", \"\")\n fmt.Println(noSpaceString)\n}<\/code><\/pre>\n\n\n\n
Thisisasamplestring<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"