微信消息推送
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

40 lines
929 B

package com.ynxbd.push.helper;
import org.springframework.util.ObjectUtils;
import java.nio.charset.StandardCharsets;
/**
* @author 李进才
* @ClassName StringHelper
* @Description description
* @date 2023/1/28 09:41
*/
public class StringHelper {
/**
* 数字倒序排列
*
* @param num 被排序数字
*/
public static String numDesc(String num) {
StringBuilder sb = new StringBuilder();
if (ObjectUtils.isEmpty(num)) {
return null;
}
for (int i = num.length() - 1; i >= 0; i--) {
sb.append(num.charAt(i));
}
return sb.toString();
}
/**
* BASE64加密
*
* @param data 需要加密的字符串
* @return 加密后的字符串
*/
public static String encode(String data) {
return java.util.Base64.getEncoder().encodeToString(data.getBytes(StandardCharsets.UTF_8));
}
}