合并主场景和个人小屋
This commit is contained in:
@@ -39,7 +39,7 @@ class_name StringUtils
|
||||
#
|
||||
# 使用示例:
|
||||
# if StringUtils.is_valid_email("user@example.com"):
|
||||
# print("邮箱格式正确")
|
||||
# # 邮箱格式正确
|
||||
static func is_valid_email(email: String) -> bool:
|
||||
var regex = RegEx.new()
|
||||
regex.compile("^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,}$")
|
||||
@@ -60,7 +60,7 @@ static func is_valid_email(email: String) -> bool:
|
||||
#
|
||||
# 使用示例:
|
||||
# if StringUtils.is_valid_username("user_123"):
|
||||
# print("用户名格式正确")
|
||||
# # 用户名格式正确
|
||||
static func is_valid_username(username: String) -> bool:
|
||||
# 检查长度
|
||||
if username.is_empty() or username.length() > 50:
|
||||
@@ -92,7 +92,7 @@ static func is_valid_username(username: String) -> bool:
|
||||
# 使用示例:
|
||||
# var result = StringUtils.validate_password_strength("MyPass123!")
|
||||
# if result.valid:
|
||||
# print("密码强度: ", result.message)
|
||||
# # 可按需展示 result.message
|
||||
static func validate_password_strength(password: String) -> Dictionary:
|
||||
var result = {"valid": false, "message": "", "strength": 0}
|
||||
|
||||
@@ -383,4 +383,4 @@ static func get_relative_time_until(utc_time_str: String) -> String:
|
||||
if minutes > 0:
|
||||
return "%d小时%d分钟后" % [hours, minutes]
|
||||
else:
|
||||
return "%d小时后" % hours
|
||||
return "%d小时后" % hours
|
||||
|
||||
Reference in New Issue
Block a user