Skip to content

Instantly share code, notes, and snippets.

@patio11
Created June 17, 2015 01:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save patio11/fe0abc1c18d09149e6c9 to your computer and use it in GitHub Desktop.
Save patio11/fe0abc1c18d09149e6c9 to your computer and use it in GitHub Desktop.
Quick sample of Golang and Ruby for string manipulation
#The task is replacing the port number in the URL string
//in golang
import "fmt"
import "strings"
func main() {
url := "http://localhost:8080/foo/bar"
fmt.Println(strings.Replace(url, "8080", "8181", -1))
}
#in ruby
url = "http://localhost:8080/foo/bar"
puts url.gsub("8080", "8181")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment