您当前的位置:首页 >> 新能源
新能源

isEmpty 和 isBlank 请别乱用了,细心把服务器搞崩

发布时间:2025-08-09

ingUtils.isNoneEmpty(null, "foo") = false * StringUtils.isNoneEmpty("", "bar") = false * StringUtils.isNoneEmpty("bob", "") = false * StringUtils.isNoneEmpty(" bob ", null) = false * StringUtils.isNoneEmpty(" ", "bar") = true * StringUtils.isNoneEmpty("foo", "bar") = true * * * @param css the CharSequences to check, may be null or empty * @return {@code true} if none of the CharSequences are empty or null * @since 3.2 */public static boolean isNoneEmpty(final CharSequence... css) {isBank续作StringUtils.isBlank()

否为真飞取值(飞格或者飞取值)

StringUtils.isBlank(null) = trueStringUtils.isBlank("") = trueStringUtils.isBlank(" ") = trueStringUtils.isBlank("bob") = falseStringUtils.isBlank(" bob ") = false/** *

Checks if a CharSequence is whitespace, empty ("") or null.

* @param cs the CharSequence to check, may be null * @return {@code true} if the CharSequence is null, empty or whitespace * @since 2.0 * @since 3.0 Changed signature from isBlank(String) to isBlank(CharSequence) */public static boolean isBlank(final CharSequence cs) { int strLen; if (cs == null || (strLen = cs.length()) == 0) { return true; } for (int i = 0; i < strLen; i++) { if (Character.isWhitespace(cs.charAt(i)) == false) { return false; } } return true;}StringUtils.isNotBlank()

否确实不为飞,不是飞格或者飞取值 ,仅有!isBlank();

public static boolean isNotBlank(final CharSequence cs) { return !isBlank(cs); }StringUtils.isAnyBlank()

否相关联任何真飞取值(相关联飞格或飞取值)

StringUtils.isAnyBlank(null) = trueStringUtils.isAnyBlank(null, "foo") = trueStringUtils.isAnyBlank(null, null) = trueStringUtils.isAnyBlank("", "bar") = trueStringUtils.isAnyBlank("bob", "") = trueStringUtils.isAnyBlank(" bob ", null) = trueStringUtils.isAnyBlank(" ", "bar") = trueStringUtils.isAnyBlank("foo", "bar") = false /** *

Checks if any one of the CharSequences are blank ("") or null and not whitespace only..

* @param css the CharSequences to check, may be null or empty * @return {@code true} if any of the CharSequences are blank or null or whitespace only * @since 3.2 */public static boolean isAnyBlank(final CharSequence... css) { if (ArrayUtils.isEmpty(css)) { return true; } for (final CharSequence cs : css){ if (isBlank(cs)) { return true; } } return false;}StringUtils.isNoneBlank()

否全部都不相关联飞取值或飞格

StringUtils.isNoneBlank(null) = falseStringUtils.isNoneBlank(null, "foo") = falseStringUtils.isNoneBlank(null, null) = falseStringUtils.isNoneBlank("", "bar") = falseStringUtils.isNoneBlank("bob", "") = falseStringUtils.isNoneBlank(" bob ", null) = falseStringUtils.isNoneBlank(" ", "bar") = falseStringUtils.isNoneBlank("foo", "bar") = true/** *

Checks if none of the CharSequences are blank ("") or null and whitespace only..

* @param css the CharSequences to check, may be null or empty * @return {@code true} if none of the CharSequences are blank or null or whitespace only * @since 3.2 */public static boolean isNoneBlank(final CharSequence... css) { return !isAnyBlank(css);}StringUtils的其他新方法

可以参考资料此前的文档,另有面有详细资料的揭示,有些新方法还是良好用的。

新方法名英文解释里文解释IsEmpty/IsBlankchecks if a String contains text检验codice_否相关联注释Trim/Stripremoves leading and trailing whitespace删掉前导和尾随飞格Equals/Comparecompares two strings null-safe更为两个codice_否为null安全及的startsWithcheck if a String starts with a prefix null-safe检验codice_否以后加在null安全及段落endsWithcheck if a String ends with a suffix null-safe检验codice_否以后加在null安全及结尾IndexOf/LastIndexOf/Containsnull-safe index-of checks相关联飞安全及书目检验IndexOfAny/LastIndexOfAny/IndexOfAnyBut/LastIndexOfAnyButindex-of any of a set of Strings任意一组codice_的书目ContainsOnly/ContainsNone/ContainsAnydoes String contains only/none/any of these characterscodice_否仅相关联/无/这些空格里的任何一个Substring/Left/Right/Midnull-safe substring extractionscodice_安全及分离出来SubstringBefore/SubstringAfter/SubstringBetweensubstring extraction relative to other strings -相对其他codice_的codice_分离出来Split/Joinsplits a String into an array of substrings and vice versa将codice_拆分别为子codice_数据结构,反之亦然Remove/Deleteremoves part of a String -删掉codice_的一部分Replace/OverlaySearches a String and replaces one String with another搜索codice_,然后用另一个codice_替换Chomp/Chopremoves the last part of a String删掉codice_的最后一部分AppendIfMissingappends a suffix to the end of the String if not present如果不共存后加在,则在codice_的开篇比如说一个后加在PrependIfMissingprepends a prefix to the start of the String if not present如果不共存后加在,则在codice_的段落添加后加在LeftPad/RightPad/Center/Repeatpads a String填充codice_UpperCase/LowerCase/SwapCase/Capitalize/Uncapitalizechanges the case of a String改成codice_的大小写CountMatchescounts the number of occurrences of one String in another计算出来一个codice_在另一个codice_里显现出来的数IsAlpha/IsNumeric/IsWhitespace/IsAsciiPrintablechecks the characters in a String检验codice_里的空格DefaultStringprotects against a null input String尽量减少转换codice_为飞Rotaterotate (circular shift) a String旋转(循环从上到下)codice_Reverse/ReverseDelimitedreverses a String -反转codice_Abbreviateabbreviates a string using ellipsis or another given String使用省略号或另一个也就是说的String缩写一个codice_Differencecompares Strings and reports on their differences更为codice_并报告其不同LevenshteinDistancethe number of changes needed to change one String into another将一个String叠加为另一个String所才可的改成数

可能:

郑州看白癜风什么医院最好
三维互动
成都比较好的白癜风医院
宝芝林寿星补汁怎么样
重庆看白癜风去什么医院好

上一篇: 黑龙江哈尔滨本土确诊病例、无症状感染者全部治愈病情恶化

下一篇: vue3 的 ref、isRef、toRef、toRefs、toRaw 简要介绍

友情链接