mirror of
https://github.com/dromara/RuoYi-Vue-Plus.git
synced 2025-09-24 07:19:46 +08:00
update 优化以逗号拼接元素
This commit is contained in:
@ -115,7 +115,7 @@ public class ServletUtils extends JakartaServletUtil {
|
||||
public static Map<String, String> getParamMap(ServletRequest request) {
|
||||
Map<String, String> params = new HashMap<>();
|
||||
for (Map.Entry<String, String[]> entry : getParams(request).entrySet()) {
|
||||
params.put(entry.getKey(), StringUtils.join(entry.getValue(), StringUtils.SEPARATOR));
|
||||
params.put(entry.getKey(), StringUtils.joinComma(entry.getValue()));
|
||||
}
|
||||
return params;
|
||||
}
|
||||
|
||||
@ -361,15 +361,24 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils {
|
||||
return input;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 以逗号拼接元素
|
||||
* 将可迭代对象中的元素使用逗号拼接成字符串
|
||||
*
|
||||
* @param iterable 可迭代对象
|
||||
* @param iterable 可迭代对象,如 List、Set 等
|
||||
* @return 拼接后的字符串
|
||||
*/
|
||||
public static String joinComma(Iterable<?> iterable) {
|
||||
return StringUtils.join(iterable, SEPARATOR);
|
||||
}
|
||||
|
||||
/**
|
||||
* 将数组中的元素使用逗号拼接成字符串
|
||||
*
|
||||
* @param array 任意类型的数组
|
||||
* @return 拼接后的字符串
|
||||
*/
|
||||
public static String joinComma(Object[] array) {
|
||||
return StringUtils.join(array, SEPARATOR);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user