| 1234567891011121314151617181920212223242526272829303132333435363738 |
- package com.ydtech.utils;
- import com.ydtech.exception.SystemException;
- /**
- * @version
- * @description: 业务中字符串处理
- * @author: wenks
- * @date: 2024/6/6 10:15
- **/
- public class StringOperations {
- private StringOperations() {
- throw new IllegalStateException("Utility class");
- }
- /**
- * 将空字符串和null 都处理为null
- * @param s 字符
- * @return
- */
- public static String emptyStringToNull(String s){
- return StringUtils.isEmpty(s) ? null : s;
- }
- /**
- * 字符串为空报错
- * @param s 字符
- * @return
- */
- public static void nullException(String s, String message){
- if (StringUtils.isEmpty(s)) {
- throw new SystemException(message);
- }
- }
- }
|