forked from neurodock/NeuroDock
f50c04c828
- Renamed package from me.zacharias.chat to me.neurodock across all 8 modules - Updated Gradle group from me.zacharias.neurodock to me.neurodock - Updated README and other files to reflect new Gitea org URL (Chat_things → neurodock) Dev note: 95 files touched. The Great Refactor is complete, long may it rest.
27 lines
918 B
Java
27 lines
918 B
Java
package me.neurodock.genius;
|
|
|
|
import java.io.UnsupportedEncodingException;
|
|
import java.net.URLEncoder;
|
|
import java.nio.charset.StandardCharsets;
|
|
import java.util.Map;
|
|
|
|
public class ParameterStringBuilder {
|
|
public static String getParamsString(Map<String, String> params)
|
|
throws UnsupportedEncodingException {
|
|
if(params == null)
|
|
return "";
|
|
StringBuilder result = new StringBuilder();
|
|
|
|
for (Map.Entry<String, String> entry : params.entrySet()) {
|
|
result.append(URLEncoder.encode(entry.getKey(), StandardCharsets.UTF_8));
|
|
result.append("=");
|
|
result.append(URLEncoder.encode(entry.getValue(), StandardCharsets.UTF_8));
|
|
result.append("&");
|
|
}
|
|
|
|
String resultString = result.toString();
|
|
return !resultString.isEmpty()
|
|
? resultString.substring(0, resultString.length() - 1)
|
|
: resultString;
|
|
}
|
|
} |