add method

This commit is contained in:
Looly 2022-01-25 11:05:23 +08:00
parent fb216a0bff
commit 763027a786
4 changed files with 8 additions and 4 deletions

View File

@ -7,9 +7,11 @@
### 🐣新特性 ### 🐣新特性
* 【extra 】 增加jetbrick模板支持 * 【extra 】 增加jetbrick模板支持
* 【extra 】 EmojiUtil增加方法pr#519@Gitee * 【extra 】 EmojiUtil增加方法pr#519@Gitee
* 【core 】 DateUtil 添加两个日期是否同一周方法pr#516@Gitee
### 🐞Bug修复 ### 🐞Bug修复
* 【core 】 修复ChineseDate农历获取正月出现数组越界BUGissue#2112@Github * 【core 】 修复ChineseDate农历获取正月出现数组越界BUGissue#2112@Github
* 【extra 】 修复EmojiUtil.toHtmlHex()方法pr#519@Gitee
------------------------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------------------------
# 5.7.20 (2022-01-20) # 5.7.20 (2022-01-20)

View File

@ -355,6 +355,7 @@ public class CalendarUtil {
* @param cal2 日期2 * @param cal2 日期2
* @param isMon 是否为周一国内第一天为星期一国外第一天为星期日 * @param isMon 是否为周一国内第一天为星期一国外第一天为星期日
* @return 是否为同一周 * @return 是否为同一周
* @since 5.7.21
*/ */
public static boolean isSameWeek(Calendar cal1, Calendar cal2, boolean isMon) { public static boolean isSameWeek(Calendar cal1, Calendar cal2, boolean isMon) {
if (cal1 == null || cal2 == null) { if (cal1 == null || cal2 == null) {

View File

@ -1006,7 +1006,7 @@ public class DateUtilTest {
} }
@Test @Test
public void isSameWeektest() { public void isSameWeekTest() {
// 周六与周日比较 // 周六与周日比较
final boolean isSameWeek = DateUtil.isSameWeek(DateTime.of("2022-01-01", "yyyy-MM-dd"), DateTime.of("2022-01-02", "yyyy-MM-dd"), true); final boolean isSameWeek = DateUtil.isSameWeek(DateTime.of("2022-01-01", "yyyy-MM-dd"), DateTime.of("2022-01-02", "yyyy-MM-dd"), true);
Assert.assertTrue(isSameWeek); Assert.assertTrue(isSameWeek);

View File

@ -126,19 +126,19 @@ public class EmojiUtil {
* @return 替换后的字符串 * @return 替换后的字符串
*/ */
public static String toHtmlHex(String str) { public static String toHtmlHex(String str) {
return EmojiParser.parseToHtmlHexadecimal(str); return toHtml(str, true);
} }
/** /**
* 将字符串中的Unicode Emoji字符转换为HTML表现形式Hex方式 * 将字符串中的Unicode Emoji字符转换为HTML表现形式Hex方式
* <p> * <p>
* 例如<code>👦🏿</code> 转换为 <code>&amp;#x1f466;</code> * 例如<code>👦🏿</code> 转换为 <code>&amp;#128102;</code>
* *
* @param str 包含Emoji Unicode字符的字符串 * @param str 包含Emoji Unicode字符的字符串
* @return 替换后的字符串 * @return 替换后的字符串
*/ */
public static String toHtml(String str) { public static String toHtml(String str) {
return toHtml(str, true); return toHtml(str, false);
} }
/** /**
@ -150,6 +150,7 @@ public class EmojiUtil {
* *
* @param str 包含Emoji Unicode字符的字符串 * @param str 包含Emoji Unicode字符的字符串
* @return 替换后的字符串 * @return 替换后的字符串
* @since 5.7.21
*/ */
public static String toHtml(String str, boolean isHex) { public static String toHtml(String str, boolean isHex) {
return isHex ? EmojiParser.parseToHtmlHexadecimal(str) : return isHex ? EmojiParser.parseToHtmlHexadecimal(str) :