James Moger
2014-03-18 b4a63aad7f56486c164a15ae2477bcd251b0bb1b
src/main/java/com/gitblit/utils/StringUtils.java
@@ -127,12 +127,26 @@
            retStr.append("%2F");
         } else if (inStr.charAt(i) == ' ') {
            retStr.append("%20");
         } else if (inStr.charAt(i) == '&') {
            retStr.append("%26");
         } else {
            retStr.append(inStr.charAt(i));
         }
         i++;
      }
      return retStr.toString();
   }
   /**
    * Flatten the list of strings into a single string with the specified
    * separator.
    *
    * @param values
    * @param separator
    * @return flattened list
    */
   public static String flattenStrings(String[]  values, String separator) {
      return flattenStrings(Arrays.asList(values), separator);
   }
   /**
@@ -747,4 +761,25 @@
      }
      return input.replace('\n',' ').replace('\r',  ' ').trim();
   }
   /**
    * Encode the username for user in an url.
    *
    * @param name
    * @return the encoded name
    */
   public static String encodeUsername(String name) {
      return name.replace("@", "%40").replace(" ", "%20").replace("\\", "%5C");
   }
   /**
    * Decode a username from an encoded url.
    *
    * @param name
    * @return the decoded name
    */
   public static String decodeUsername(String name) {
      return name.replace("%40", "@").replace("%20", " ").replace("%5C", "\\");
   }
}