SpringBoot_UUID工具类

作用

去掉UUID随机生成的ID中的" - "

package com.Ldh.util;

import java.util.UUID;

public class UUIDUtil {

	public static String getUUID(){
		String id = UUID.randomUUID().toString();
		String uid = id.replaceAll("-", "");
		
		return uid;
	}
	
	//测试
	public static void main(String[] args) {
		
		String uid = UUIDUtil.getUUID();
		System.out.println("===="+uid);
	}
}

你可能感兴趣的:(java,java,后端)