stripTrailingSlash method

String stripTrailingSlash (String url)

If url has a trailing slash, remove it, otherwise return url as is.

Implementation

static String stripTrailingSlash(String url) {
  if (url.endsWith('/')) {
    url = url.substring(0, url.length - 1);
  }
  return url;
}