function encodeDashes(str) { // Replace dashes with encoded "\-"
    return encodeURIComponent(str).replace(/-/g, function(c) { return '%5C%' + c.charCodeAt(0).toString(16).toUpperCase(); });
  }
@ngdoc function
@name ui.router.util.type:UrlMatcher#format
@methodOf ui.router.util.type:UrlMatcher

@description
Creates a URL that matches this pattern by substituting the specified values
for the path and search parameters. Null values for path parameters are
treated as empty strings.

@example
<pre>
new UrlMatcher('/user/{id}?q').format({ id:'bob', q:'yes' });
// returns '/user/bob?q=yes'
</pre>

@param {Object} values  the values to substitute for the parameters in this pattern.
@returns {string}  the formatted URL (path and optionally search part).