删除特定字符串之间的空格

I need to remove whitespace between </Listing> and <Listing> inside a file.

I looked here:

How to trim leading and trailing white spaces of a string?

But that is not string specific.

If you're munging nested/structured data like XML I'd strongly suggest using a real XML parser.

But just using a regexp it isn't too hard:

r := regexp.MustCompile(`(?m:</Listing>\s*<Listing>)`)
var s string = "</Listing><Listing>"
fmt.Println(r.ReplaceAllString("</Listing>  

 <Listing>", s))

Note the ?m regexp flag to enabled multi-line matching (assuming you want to allow </Listing> and <Listing> to be on separate lines