当前位置:网站首页>Hutool string utility class
Hutool string utility class
2022-07-27 18:09:00 【@Calm down】
// String utility class
@Test
public void test13(){
// Judge empty , An empty string , And spaces isempty Can't judge spaces
String a=" ";
if(StrUtil.isBlank(a)){
System.out.println("dddd");
}
// Remove suffix
String b="j.a.txt";
Console.log(StrUtil.removeSuffix(b,".txt"));// j.a
Console.log(StrUtil.removePrefix(b,"j."));// a.txt
// Intercepting string
String str = "abcdefgh";
String strSub1 = StrUtil.sub(str, 2, 3); //strSub1 -> c
String strSub2 = StrUtil.sub(str, 2, -3); //strSub2 -> cde
String strSub3 = StrUtil.sub(str, 3, 2); //strSub2 -> c
//format Method Awesome stitching
String template = "{}love{}";
Console.log(StrUtil.format(template, " I ", " you ")); //str -> I love you! , Just like mice Love Rice
//HexUtil That is, string or byte An array with the 16 Hexadecimal represents the tool class of conversion
String strs = " I'm a string ";
String hex = HexUtil.encodeHexStr(strs, CharsetUtil.CHARSET_UTF_8);
//hex yes :
//e68891e698afe4b880e4b8aae5ad97e7aca6e4b8b2
String decodedStr = HexUtil.decodeHexStr(hex);
// Decode and str identical
}
边栏推荐
- Soul 1: why is es more suitable for complex condition search than MySQL?
- 【Codeforces】 B. Make it Divisible by 25
- Evaluation index of machine learning (I) -- regression evaluation index
- Zhengzhou University database course resource description
- 微信小程序 实现位置地图显示,引入map地图,不含导航
- [introduction to database system (Wang Shan)] Chapter 5 - database integrity
- Personal understanding of convolution calculation process of convolution neural network
- Run loam_ Velodyne real-time mapping
- Count the six weapons of the domestic interface cooperation platform!
- js实现右键菜单栏功能
猜你喜欢

登录页面tableLayout(表格布局)

7月第4周易盾业务风控关注 | 最高法对APP强索个人信息进行规制

vue使用keep-alive实现页面缓存

JDBC connection database reading foreground cannot display data

Convolutional neural network -- Translation of yolov2 (yolo9000) papers

Fast parsing combined with Huatu document encryption software

Knowing things by learning | app slimming down, the way of safety reinforcement under the new generation AAB framework

快解析结合海典医药

vim的配置及基础使用

Establishing SSL connection without server‘s identity verification is not recommended
随机推荐
MySQL adds users and grants query only permission
JS中的冒泡排序
How to solve the error of ora-00955 when Oracle modifies the primary key
Dbeaver connection MySQL error: the server time zone value 'Ö Ð¹ ú±ê ×¼ ʱ ¼ ä‘ is unrecognized or represents more than
公网域名如何解析到内网IP服务器——快解析域名映射外网访问
In the fourth week of July, Yidun business risk control focused on the supreme law to regulate app's forcible request for personal information
ts学习笔记-class
面试好难啊!蚂蚁金服的六轮面试我是强撑过来!差点OUT(面试复盘)
ts学习笔记-interface
EF框架简介
年终总结模板
Help, boost and take responsibility, the new value and significance of the 6th Tuba rabbit 718 national home decoration Festival
[introduction to database system (Wang Shan)] Chapter 4 - Database Security
WebDriverException( selenium.common.exceptions.WebDriverException: Message: ‘chromedriver‘ executabl
Convolutional neural network -- SSD thesis translation
卷积神经网络——FPN(Feature Pyramid Networks)介绍
Evaluation index of machine learning (I) -- regression evaluation index
Wechat applet realizes location map display and introduces map map without navigation
hutool 字符串工具类
golang chan实现互斥锁