cn.hutool.core.lang.Assert.notContain()方法的使用及代码示例

x33g5p2x  于2022-01-17 转载在 其他  
字(2.0k)|赞(0)|评价(0)|浏览(217)

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

Assert.notContain介绍

[英]断言给定字符串是否不被另一个字符串包含(既是否为子串)

Assert.doesNotContain(name, "rod", "Name must not contain 'rod'");

[中]断言给定字符串是否不被另一个字符串包含(既是否为子串)

Assert.doesNotContain(name, "rod", "Name must not contain 'rod'");

代码示例

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

/**
 * 断言给定字符串是否不被另一个字符串包含(既是否为子串)
 * 
 * <pre class="code">
 * Assert.doesNotContain(name, "rod", "Name must not contain 'rod'");
 * </pre>
 * 
 * @param textToSearch 被搜索的字符串
 * @param substring 被检查的子串
 * @return 被检查的子串
 * @throws IllegalArgumentException 非子串抛出异常
 */
public static String notContain(String textToSearch, String substring) throws IllegalArgumentException {
  return notContain(textToSearch, substring, "[Assertion failed] - this String argument must not contain the substring [{}]", substring);
}

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

/**
 * 断言给定字符串是否不被另一个字符串包含(既是否为子串)
 * 
 * <pre class="code">
 * Assert.doesNotContain(name, "rod", "Name must not contain 'rod'");
 * </pre>
 * 
 * @param textToSearch 被搜索的字符串
 * @param substring 被检查的子串
 * @return 被检查的子串
 * @throws IllegalArgumentException 非子串抛出异常
 */
public static String notContain(String textToSearch, String substring) throws IllegalArgumentException {
  return notContain(textToSearch, substring, "[Assertion failed] - this String argument must not contain the substring [{}]", substring);
}

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

/**
 * 断言给定字符串是否不被另一个字符串包含(既是否为子串)
 * 
 * <pre class="code">
 * Assert.doesNotContain(name, "rod", "Name must not contain 'rod'");
 * </pre>
 * 
 * @param textToSearch 被搜索的字符串
 * @param substring 被检查的子串
 * @return 被检查的子串
 * @throws IllegalArgumentException 非子串抛出异常
 */
public static String notContain(String textToSearch, String substring) throws IllegalArgumentException {
  return notContain(textToSearch, substring, "[Assertion failed] - this String argument must not contain the substring [{}]", substring);
}

相关文章