2024-04-06 04:10:15 +01:00
|
|
|
package cc.fascinated.util;
|
|
|
|
|
2024-04-08 05:22:54 +01:00
|
|
|
import lombok.experimental.UtilityClass;
|
|
|
|
|
|
|
|
@UtilityClass
|
2024-04-06 04:10:15 +01:00
|
|
|
public class UUIDUtils {
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Add dashes to a UUID.
|
|
|
|
*
|
|
|
|
* @param idNoDashes the UUID without dashes
|
|
|
|
* @return the UUID with dashes
|
|
|
|
*/
|
2024-04-08 06:13:03 +01:00
|
|
|
public static String addUuidDashes(String idNoDashes) {
|
2024-04-06 04:10:15 +01:00
|
|
|
StringBuilder idBuff = new StringBuilder(idNoDashes);
|
|
|
|
idBuff.insert(20, '-');
|
|
|
|
idBuff.insert(16, '-');
|
|
|
|
idBuff.insert(12, '-');
|
|
|
|
idBuff.insert(8, '-');
|
|
|
|
return idBuff.toString();
|
|
|
|
}
|
|
|
|
}
|