Pick/UniBasic 使用多个字符的分隔符操作的字段函数?
Pick/UniBasic Field function that operates with a delimiter of more than one character?
有没有在 Pick/UniBasic 等的各种风格中实现 field function (page 311) 等,可以对多个字符的分隔符进行操作?
我能找到的文档化实现规定一个字符作为定界符参数,如果定界符有多个字符,则使用定界符字符串的第一个字符而不是整个字符串作为定界符。
我问这个是因为在我维护的商业和自定义软件中有很多实例,我看到有人试图在字段语句中使用多字符定界符。似乎程序员在使用它时期望的结果与当前发生的结果不同。
jBASE does allow for this. From the FIELD 文档:
This function returns a multi-character delimited field from within a string. It takes the general form:
FIELD(string, delimiter, occurrence{, extractCount})
where:
string
specifies the string, from which the field(s) is to be extracted.
delimiter
specifies the character or characters that delimit the fields within the dynamic array.
occurrence
should evaluate to an integer of value 1 or higher. It specifies the delimiter used as the starting point for the extraction.
extractCount
is an integer that specifies the number of fields to extract. If omitted, assumes one.
此外,文档中的示例:
in_Value = "AAAA : BBjBASEBB : CCCCC"
CRT FIELD(in_Value , "jBASE", 1)
生成输出:
AAAA : BB
2020-08-13 更新(为 OpenQM 添加上下文):
作为官方评论,因为我们同时维护 jBASE 和 OpenQM,我觉得值得一提的是 OpenQM not 允许 FIELD()
的多字符定界符。
有没有在 Pick/UniBasic 等的各种风格中实现 field function (page 311) 等,可以对多个字符的分隔符进行操作?
我能找到的文档化实现规定一个字符作为定界符参数,如果定界符有多个字符,则使用定界符字符串的第一个字符而不是整个字符串作为定界符。
我问这个是因为在我维护的商业和自定义软件中有很多实例,我看到有人试图在字段语句中使用多字符定界符。似乎程序员在使用它时期望的结果与当前发生的结果不同。
jBASE does allow for this. From the FIELD 文档:
This function returns a multi-character delimited field from within a string. It takes the general form:
FIELD(string, delimiter, occurrence{, extractCount})
where:
string
specifies the string, from which the field(s) is to be extracted.
delimiter
specifies the character or characters that delimit the fields within the dynamic array.
occurrence
should evaluate to an integer of value 1 or higher. It specifies the delimiter used as the starting point for the extraction.
extractCount
is an integer that specifies the number of fields to extract. If omitted, assumes one.
此外,文档中的示例:
in_Value = "AAAA : BBjBASEBB : CCCCC"
CRT FIELD(in_Value , "jBASE", 1)
生成输出:
AAAA : BB
2020-08-13 更新(为 OpenQM 添加上下文):
作为官方评论,因为我们同时维护 jBASE 和 OpenQM,我觉得值得一提的是 OpenQM not 允许 FIELD()
的多字符定界符。