Crystal XI - 提取字符串的一部分

时间:2014-05-14 14:19:20

标签: string extract crystal-reports-xi

如何从Crystal语法的字符串中提取最后一组括号(包括括号)中的文本?

字符串示例:

"Coaching (CG) and Mentoring (MG) (SST)"

结果应为:

(SST)

//我正在使用这个公式:

right({LMS_sch_Course_Table.NamePrimary},(len({LMS_sch_Course_Table.NamePrimary})-instr({LMS_sch_Course_Table.NamePrimary}," ("))+1) 

// unfortunatley它给了我“(CG)和指导(MG)(SST)”

1 个答案:

答案 0 :(得分:0)

Right("Coaching (CG) and Mentoring (MG) (SST)",5)

编辑---------------------------------------------- ------------------------------

Local Stringvar x:=databasefield;
Local Numbervar i;
Local Stringvar y;
Local Stringvar Array z:=(Split (x," "));

for  i:=1 to count(z) do
(
if("(" in z[i])
then
y:=z[i]
);

y;