|
本帖最后由 qq202777898 于 2025-4-23 09:12 编辑
豆包写的
/* 计算模型名称字符串的长度 */
StrLen = string_length(rel_model_name())
/* 第一次查找分隔符 "-" 的位置 */
first_index = search(rel_model_name(), "-")
/* 如果第一次找到了分隔符 */
if first_index > 0
/* 从第一次找到的位置的下一个字符开始,继续查找分隔符 */
second_index = search(extract(rel_model_name(), first_index + 1, StrLen - first_index), "-")
/* 如果第二次也找到了分隔符 */
if second_index > 0
/* 从第二次找到的位置的下一个字符开始,继续查找分隔符,以此类推 */
third_index = search(extract(rel_model_name(), first_index + second_index + 1, StrLen - first_index - second_index), "-")
if third_index > 0
/* 假设最多有 4 个分隔符,这里处理找到 4 个分隔符的情况 */
fourth_index = search(extract(rel_model_name(), first_index + second_index + third_index + 1, StrLen - first_index - second_index - third_index), "-")
if fourth_index > 0
last_separator_index = first_index + second_index + third_index + fourth_index
else
last_separator_index = first_index + second_index + third_index
endif
else
last_separator_index = first_index + second_index
endif
else
last_separator_index = first_index
endif
else
last_separator_index = 0
endif
/* 若存在分隔符,则提取最后一部分;若不存在分隔符,则整个字符串即为结果 */
ZZ = if(last_separator_index > 0, extract(rel_model_name(), last_separator_index + 1, StrLen - last_separator_index), rel_model_name()) |
-
|