当前位置:网站首页>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
}
边栏推荐
猜你喜欢

Count the six weapons of the domestic interface cooperation platform!

What's the use of games| Game application value research case collection

Learn from things | Yidun mobile terminal isomorphism practice, improve the official website interaction experience in a few steps

Wechat applet realizes location map display and introduces map map without navigation

Fast parsing combined with Huatu document encryption software
知物由学 | SO加固如何提升Android应用的安全性?

Oracle 11g database installation tutorial
How to improve the security of Android applications?

知物由学 | APP大瘦身,新一代AAB框架下的安全加固之道

机器学习——概念理解之IoU
随机推荐
How to develop an online Excel spreadsheet system (Part 1)
快速获取网站媒体资源方法
golang worker池
Salesforce certified sharing and visibility Designer (su20) certification examination summary
Machine learning: IOU of concept understanding
I got the P8 "top-level" distributed architecture manual crazy spread on Alibaba intranet
卷积神经网络——FPN(Feature Pyramid Networks)介绍
shell常见命令(1)——变量大小写转换
Convolutional neural network -- Translation of yolov1 thesis
What's the use of games| Game application value research case collection
JS中的冒泡排序
Knowledge dry goods: basic storage service novice Experience Camp
hutool- 数字计算
Does PostgreSQL 14 support winserver2022?
[introduction to database system (Wang Shan)] Chapter 5 - database integrity
Class not found: “com.parkManagement.dao.DaoTest 测试找不到测试类
MySQL 中 You can‘t specify target table ‘表名‘ for update in FROM clause错误解决办法
How to solve the error of ora-00955 when Oracle modifies the primary key
ts学习笔记-interface
7月第4周易盾业务风控关注 | 最高法对APP强索个人信息进行规制