/*
*Copyright © 2018 anji-plus
*安吉加加信息技术有限公司
*http://www.anji-plus.com
*All rights reserved.
*/
package com.anji.captcha.util;
public class StringUtils {
/**
* The empty String <code>""</code>.
* @since 2.0
*/
public static final String EMPTY = "";
/**
* Represents a failed index search.
* @since 2.1
*/
public static final int INDEX_NOT_FOUND = -1;
/**
* <p>The maximum size to which the padding constant(s) can expand.</p>
*/
private static final int PAD_LIMIT = 8192;
/**
* <p><code>StringUtils</code> instances should NOT be constructed in
* standard programming. Instead, the class should be used as
* <code>StringUtils.trim(" foo ");</code>.</p>
*
* <p>This constructor is public to permit tools that require a JavaBean
* instance to operate.</p>
*/
public StringUtils() {
super();
}
// Empty checks
//-----------------------------------------------------------------------
/**
* <p>Checks if a String is empty ("") or null.</p>
*
* <pre>
* StringUtils.isEmpty(null) = true
* StringUtils.isEmpty("") = true
* StringUtils.isEmpty(" ") = false
* StringUtils.isEmpty("bob") = false
* StringUtils.isEmpty(" bob ") = false
* </pre>
*
* <p>NOTE: This method changed in Lang version 2.0.
* It no longer trims the String.
* That functionality is available in isBlank().</p>
*
* @param str the String to check, may be null
* @return <code>true</code> if the String is empty or null
*/
public static boolean isEmpty(String str) {
return str == null || str.length() == 0;
}
/**
* <p>Checks if a String is not empty ("") and not null.</p>
*
* <pre>
* StringUtils.isNotEmpty(null) = false
* StringUtils.isNotEmpty("") = false
* StringUtils.isNotEmpty(" ") = true
* StringUtils.isNotEmpty("bob") = true
* StringUtils.isNotEmpty(" bob ") = true
* </pre>
*
* @param str the String to check, may be null
* @return <code>true</code> if the String is not empty and not null
*/
public static boolean isNotEmpty(String str) {
return !StringUtils.isEmpty(str);
}
/**
* <p>Checks if a String is whitespace, empty ("") or null.</p>
*
* <pre>
* StringUtils.isBlank(null) = true
* StringUtils.isBlank("null") = true
* StringUtils.isBlank("") = true
* StringUtils.isBlank(" ") = true
* StringUtils.isBlank("bob") = false
* StringUtils.isBlank(" bob ") = false
* </pre>
*
* @param str the String to check, may be null
* @return <code>true</code> if the String is null, empty or whitespace
* @since 2.0
*/
public static boolean isBlank(String str) {
int strLen;
if (str == null || (strLen = str.length()) == 0) {
return true;
}
if(equals("null", str.trim().toLowerCase())){
return true;
}
for (int i = 0; i < strLen; i++) {
if ((Character.isWhitespace(str.charAt(i)) == false)) {
return false;
}
}
return true;
}
/**
* <p>Checks if a String is not empty (""), not null and not whitespace only.</p>
*
* <pre>
* StringUtils.isNotBlank(null) = false
* StringUtils.isNotBlank("null") = false
* StringUtils.isNotBlank("") = false
* StringUtils.isNotBlank(" ") = false
* StringUtils.isNotBlank("bob") = true
* StringUtils.isNotBlank(" bob ") = true
* </pre>
*
* @param str the String to check, may be null
* @return <code>true</code> if the String is
* not empty and not null and not whitespace
* @since 2.0
*/
public static boolean isNotBlank(String str) {
return !StringUtils.isBlank(str);
}
// Trim
//-----------------------------------------------------------------------
/**
* <p>Removes control characters (char <= 32) from both
* ends of this String, handling <code>null</code> by returning
* an empty String ("").</p>
*
* <pre>
* StringUtils.clean(null) = ""
* StringUtils.clean("") = ""
* StringUtils.clean("abc") = "abc"
* StringUtils.clean(" abc ") = "abc"
* StringUtils.clean(" ") = ""
* </pre>
*
* @see java.lang.String#trim()
* @param str the String to clean, may be null
* @return the trimmed text, never <code>null</code>
* @deprecated Use the clearer named {@link #trimToEmpty(String)}.
* Method will be removed in Commons Lang 3.0.
*/
public static String clean(String str) {
return str == null ? EMPTY : str.trim();
}
/**
* <p>Removes control characters (char <= 32) from both
* ends of this String, handling <code>null</code> by returning
* <code>null</code>.</p>
*
* <p>The String is trimmed using {@link String#trim()}.
* Trim removes start and end characters <= 32.
* To strip whitespace use {@link #strip(String)}.</p>
*
* <p>To trim your choice of characters, use the
* {@link #strip(String, String)} methods.</p>
*
* <pre>
* StringUtils.trim(null) = null
* StringUtils.trim("") = ""
* StringUtils.trim(" ") = ""
* StringUtils.trim("abc") = "abc"
* StringUtils.trim(" abc ") = "abc"
* </pre>
*
* @param str the String to be trimmed, may be null
* @return the trimmed string, <code>null</code> if null String input
*/
public static String trim(String str) {
return str == null ? null : str.trim();
}
/**
* <p>Removes control characters (char <= 32) from both
* ends of this String returning <code>null</code> if the String is
* empty ("") after the trim or if it is <code>null</code>.
*
* <p>The String is trimmed using {@link String#trim()}.
* Trim removes start and end characters <= 32.
* To strip whitespace use {@link #stripToNull(String)}.</p>
*
* <pre>
* StringUtils.trimToNull(null) = null
* StringUtils.trimToNull("") = null
* StringUtils.trimToNull(" ") = null
* StringUtils.trimToNull("abc") = "abc"
* StringUtils.trimToNull(" abc ") = "abc"
* </pre>
*
* @param str the String to be trimmed, may be null
* @return the trimmed String,
* <code>null</code> if only chars <= 32, empty or null String input
* @since 2.0
*/
public static String trimToNull(String str) {
String ts = trim(str);
return isEmpty(ts) ? null : ts;
}
/**
* <p>Removes control characters (char <= 32) from both
* ends of this String returning an empty String ("") if the String
* is empty ("") after the trim or if it is <code>null</code>.
*
* <p>The String is trimmed using {@link String#trim()}.
* Trim removes start and end characters <= 32.
* To strip whitespace use {@link #stripToEmpty(String)}.</p>
*
* <pre>
* StringUtils.trimToEmpty(null) = ""
* StringUtils.trimToEmpty("") = ""
* StringUtils.trimToEmpty(" ") = ""
* StringUtils.trimToEmpty("abc") = "abc"
* StringUtils.trimToEmpty(" abc ") = "abc"
* </pre>
*
* @param str the String to be trimmed, may be null
* @return the trimmed String, or an empty String if <code>null</code> input
* @since 2.0
*/
public static String trimToEmpty(String str) {
return str == null ? EMPTY : str.trim();
}
// Stripping
//-----------------------------------------------
没有合适的资源?快使用搜索试试~ 我知道了~
AJ-Captcha-java
共1617个文件
png:343个
php:242个
swift:139个
需积分: 1 0 下载量 29 浏览量
2024-09-05
10:19:11
上传
评论
收藏 75.8MB ZIP 举报
温馨提示
()(java)vue/h5/Android/IOS/flutter/uni-app/react/php/go/ java java java java java
资源推荐
资源详情
资源评论
收起资源包目录
AJ-Captcha-java (1617个子文件)
android-demo.apk 5.97MB
app-debug.apk 4.7MB
artisan 2KB
.babelrc 230B
gradlew.bat 2KB
gradlew.bat 2KB
.browserslistrc 703B
.browserslistrc 30B
com.anji.captcha.service.CaptchaCacheService 58B
com.anji.captcha.service.CaptchaCacheService 56B
com.anji.captcha.service.CaptchaCacheService 53B
com.anji.captcha.service.CaptchaService 235B
index.2d26d90a.css 79KB
index.css 56KB
styles.css 13KB
common.css 13KB
verify.css 7KB
verify.css 7KB
verify.css 7KB
verify.css 7KB
app.component.css 5KB
group.css 5KB
theme.css 870B
index.css 366B
verifyClick.component.css 253B
verifySlipping.component.css 253B
block_puzzle_captcha.dart 25KB
block_puzzle_captcha.dart 24KB
click_word_captcha.dart 11KB
click_word_captcha.dart 11KB
widget_util.dart 5KB
widget_util.dart 4KB
login.dart 3KB
login.dart 3KB
HttpManager.dart 2KB
HttpManager.dart 2KB
SignConfig.dart 1KB
SignConfig.dart 1KB
widget_test.dart 1KB
widget_test.dart 1KB
main.dart 961B
main.dart 961B
encrypt_util.dart 776B
object_utils.dart 635B
object_utils.dart 633B
encrypt_util.dart 632B
demo.dart 546B
demo.dart 546B
.editorconfig 274B
.editorconfig 271B
.editorconfig 147B
iconfont.eot 2KB
iconfont.eot 2KB
iconfont.eot 2KB
iconfont.eot 2KB
.eslintcache 59KB
.eslintignore 34B
spring.factories 113B
滑动拼图.gif 72KB
点选文字.gif 43KB
.gitattributes 115B
.gitignore 631B
.gitignore 542B
.gitignore 542B
.gitignore 310B
.gitignore 239B
.gitignore 231B
.gitignore 208B
.gitignore 208B
.gitignore 163B
.gitignore 154B
.gitignore 152B
.gitignore 145B
.gitignore 110B
.gitignore 110B
.gitignore 56B
.gitignore 38B
.gitignore 38B
.gitignore 24B
.gitignore 7B
.gitignore 7B
.gitignore 0B
.gitkeep 0B
.gitkeep 0B
.gitkeep 0B
block_puzzle_captcha_service.go 6KB
click_word_captcha_service.go 6KB
image_util.go 5KB
example.go 4KB
click_word_captcha_service_test.go 2KB
image.go 2KB
cache_util_test.go 2KB
cache_util.go 2KB
aes_util.go 2KB
captcha_service_factory.go 1KB
mem_cache_service.go 942B
config.go 933B
font_util.go 898B
const.go 861B
block_puzzle_captcha_service_test.go 819B
共 1617 条
- 1
- 2
- 3
- 4
- 5
- 6
- 17
资源评论
csbysj2020
- 粉丝: 2402
- 资源: 5445
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功