
com.huaweicloud.dws.client.util.IdentifierUtil Maven / Gradle / Ivy
package com.huaweicloud.dws.client.util;
import java.util.Locale;
import java.util.Objects;
/**
* @ProjectName: dws-connector
* @ClassName: IdentifierUtil
* @Description:
* @Date: 2023/1/16 18:53
* @Version: 1.0
*/
public class IdentifierUtil {
/**
* 处理字段引号问题
*/
public static String quoteIdentifier(String identifier) {
return identifier.startsWith("\"") ? identifier : "\"" + identifier + "\"";
}
/**
* 替换数据中特殊字符
*/
public static String replaceValue(String value) {
return value == null ? null : value.replace("\\", "\\\\")
.replace("\u0000", "");
}
public static String replaceValueForCsv(String value) {
return value == null ? null : value
.replace("\"", "\"\"");
}
public static String toLowerIfNoSensitive(String src, boolean caseSensitive) {
if (Objects.isNull(src)) {
return null;
}
return caseSensitive ? src : src.toLowerCase(Locale.ROOT);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy