cn.hutool.core.util.StrUtil.unWrap()方法的使用及代码示例

x33g5p2x  于2022-01-30 转载在 其他  
字(4.7k)|赞(0)|评价(0)|浏览(319)

本文整理了Java中cn.hutool.core.util.StrUtil.unWrap()方法的一些代码示例,展示了StrUtil.unWrap()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。StrUtil.unWrap()方法的具体详情如下:
包路径:cn.hutool.core.util.StrUtil
类名称:StrUtil
方法名:unWrap

StrUtil.unWrap介绍

[英]去掉字符包装,如果未被包装则返回原字符串
[中]去掉字符包装,如果未被包装则返回原字符串

代码示例

代码示例来源:origin: looly/hutool

/**
 * 去掉字符包装,如果未被包装则返回原字符串
 * 
 * @param str 字符串
 * @param prefixAndSuffix 前置和后置字符
 * @return 去掉包装字符的字符串
 * @since 4.0.1
 */
public static String unWrap(CharSequence str, char prefixAndSuffix) {
  return unWrap(str, prefixAndSuffix, prefixAndSuffix);
}

代码示例来源:origin: looly/hutool

/**
 * 去掉字符包装,如果未被包装则返回原字符串
 * 
 * @param str 字符串
 * @param prefixAndSuffix 前置和后置字符
 * @return 去掉包装字符的字符串
 * @since 4.0.1
 */
public static String unWrap(CharSequence str, char prefixAndSuffix) {
  return unWrap(str, prefixAndSuffix, prefixAndSuffix);
}

代码示例来源:origin: looly/hutool

/**
 * 对于非表达式去除单引号
 * 
 * @param expression 表达式
 * @return 表达式
 */
private static String unWrapIfPossible(CharSequence expression) {
  if (StrUtil.containsAny(expression, " = ", " > ", " < ", " like ", ",")) {
    return expression.toString();
  }
  return StrUtil.unWrap(expression, '\'');
}
// ------------------------------------------------------------------------------------------------------------------------------------- Private method end

代码示例来源:origin: looly/hutool

/**
 * 对于非表达式去除单引号
 * 
 * @param expression 表达式
 * @return 表达式
 */
private static String unWrapIfPossible(CharSequence expression) {
  if (StrUtil.containsAny(expression, " = ", " > ", " < ", " like ", ",")) {
    return expression.toString();
  }
  return StrUtil.unWrap(expression, '\'');
}
// ------------------------------------------------------------------------------------------------------------------------------------- Private method end

代码示例来源:origin: looly/hutool

copyLen = 0;
  currentFields.add(StrUtil.unWrap(localCurrentField.toStringAndReset(), config.textDelimiter));
  localCopyStart = localBufPos;
} else if (c == config.textDelimiter) {
    localCurrentField.append(localBuf, localCopyStart, copyLen);
  currentFields.add(StrUtil.unWrap(localCurrentField.toStringAndReset(), config.textDelimiter));
  localPreChar = c;
  localCopyStart = localBufPos;
      localCurrentField.append(localBuf, localCopyStart, copyLen);
    currentFields.add(StrUtil.unWrap(localCurrentField.toStringAndReset(), config.textDelimiter));
    localPreChar = c;
    localCopyStart = localBufPos;

代码示例来源:origin: looly/hutool

copyLen = 0;
  currentFields.add(StrUtil.unWrap(localCurrentField.toStringAndReset(), config.textDelimiter));
  localCopyStart = localBufPos;
} else if (c == config.textDelimiter) {
    localCurrentField.append(localBuf, localCopyStart, copyLen);
  currentFields.add(StrUtil.unWrap(localCurrentField.toStringAndReset(), config.textDelimiter));
  localPreChar = c;
  localCopyStart = localBufPos;
      localCurrentField.append(localBuf, localCopyStart, copyLen);
    currentFields.add(StrUtil.unWrap(localCurrentField.toStringAndReset(), config.textDelimiter));
    localPreChar = c;
    localCopyStart = localBufPos;

代码示例来源:origin: looly/hutool

final String[] unwrapedKeys = new String[keys.size()];
for (int i = 0; i < unwrapedKeys.length; i++) {
  unwrapedKeys[i] = StrUtil.unWrap(keys.get(i), '\'');

代码示例来源:origin: looly/hutool

final String[] unwrapedKeys = new String[keys.size()];
for (int i = 0; i < unwrapedKeys.length; i++) {
  unwrapedKeys[i] = StrUtil.unWrap(keys.get(i), '\'');

代码示例来源:origin: cn.hutool/hutool-all

/**
 * 去掉字符包装,如果未被包装则返回原字符串
 * 
 * @param str 字符串
 * @param prefixAndSuffix 前置和后置字符
 * @return 去掉包装字符的字符串
 * @since 4.0.1
 */
public static String unWrap(CharSequence str, char prefixAndSuffix) {
  return unWrap(str, prefixAndSuffix, prefixAndSuffix);
}

代码示例来源:origin: cn.hutool/hutool-all

/**
 * 对于非表达式去除单引号
 * 
 * @param expression 表达式
 * @return 表达式
 */
private static String unWrapIfPossible(CharSequence expression) {
  if (StrUtil.containsAny(expression, " = ", " > ", " < ", " like ", ",")) {
    return expression.toString();
  }
  return StrUtil.unWrap(expression, '\'');
}
// ------------------------------------------------------------------------------------------------------------------------------------- Private method end

代码示例来源:origin: cn.hutool/hutool-all

copyLen = 0;
  currentFields.add(StrUtil.unWrap(localCurrentField.toStringAndReset(), config.textDelimiter));
  localCopyStart = localBufPos;
} else if (c == config.textDelimiter) {
    localCurrentField.append(localBuf, localCopyStart, copyLen);
  currentFields.add(StrUtil.unWrap(localCurrentField.toStringAndReset(), config.textDelimiter));
  localPreChar = c;
  localCopyStart = localBufPos;
      localCurrentField.append(localBuf, localCopyStart, copyLen);
    currentFields.add(StrUtil.unWrap(localCurrentField.toStringAndReset(), config.textDelimiter));
    localPreChar = c;
    localCopyStart = localBufPos;

代码示例来源:origin: cn.hutool/hutool-all

final String[] unwrapedKeys = new String[keys.size()];
for (int i = 0; i < unwrapedKeys.length; i++) {
  unwrapedKeys[i] = StrUtil.unWrap(keys.get(i), '\'');

相关文章

StrUtil类方法