mirror of
https://github.com/jlengrand/openapi-generator.git
synced 2026-05-16 08:31:26 +00:00
Extract utility methods to the StringUtil class
and ignore case when comparing Accept/Content-Type
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
package {{invokerPackage}};
|
||||
|
||||
public class StringUtil {
|
||||
public static boolean containsIgnoreCase(String[] array, String value) {
|
||||
for (String str : array) {
|
||||
if (value == null && str == null) return true;
|
||||
if (value != null && value.equalsIgnoreCase(str)) return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static String join(String[] array, String separator) {
|
||||
int len = array.length;
|
||||
if (len == 0) return "";
|
||||
|
||||
StringBuilder out = new StringBuilder();
|
||||
out.append(array[0]);
|
||||
for (int i = 1; i < len; i++) {
|
||||
out.append(separator).append(array[i]);
|
||||
}
|
||||
return out.toString();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user