Ruby string manipulation, remove first 3 characters and add them to the end of the string
ruby
Solution
A regular expression with groups would work well:
`mystring.gsub(/^([a-z]+)-(\w+)/, '\2(\1)')`
Problem
``` mystring = "svn-myapplication" or mystring = "git-myapplication" ``` My desired output: ``` mystring = "myapplications(svn)" mystring = "myapplication(git)" ``` Question: The first 3 characters of the string should be moved to the last with enclosed brackets and the "-" should be removed. I tried to do something like this: `mystring.gsub('svn-','')+"(svn)"` but svn might be git, so i want to use the first three characters to be moved to end with "-" removed and brackets enclosed