Add UUID function #287

This commit is contained in:
Francis Dong
2021-08-27 18:31:33 +08:00
committed by dxfeng10
parent b46f9a1f7b
commit 298d085631

View File

@@ -16,6 +16,8 @@
*/
package we.fizz.function;
import java.util.UUID;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -59,6 +61,7 @@ public class StringFunc implements IFunc {
FuncExecutor.register(NAME_SPACE_PREFIX + "string.endsWith", this);
FuncExecutor.register(NAME_SPACE_PREFIX + "string.toUpperCase", this);
FuncExecutor.register(NAME_SPACE_PREFIX + "string.toLowerCase", this);
FuncExecutor.register(NAME_SPACE_PREFIX + "string.uuid", this);
}
/**
@@ -155,4 +158,8 @@ public class StringFunc implements IFunc {
return str.toLowerCase();
}
public String uuid() {
return UUID.randomUUID().toString().replaceAll("-", "");
}
}