Crystal报表:在检测到3个逗号后换行。

huangapple go评论59阅读模式
英文:

Crystal report New line after detect 3 commas

问题

Crystal Report 在检测到 3 个逗号后换行
我有类似 "A,B,C,D,E,F,G" 的文本
我该如何编写代码?

我想要显示

A,B,C,

D,E,F,

G

英文:

Crystal report a New line after detecting 3 commas
I have Text like "A,B,C,D,E,F,G"
how could I code?

I would like to show

A,B,C,

D,E,F,

G

答案1

得分: 0

请看以下代码:

尝试这个:

    local numbervar counter := 0;
    local stringvar result := ""
    local numbervar i;
    For i := 1 to Len({@yourText}) do
    (
    IF {@yourText}[i] <> "," Then result := result + {@yourText}[i];
    
    IF {@yourText}[i] = "," Then 
       IF counter = 2 THEN 
       (counter := 0; 
        result := result + CHR(10) + CHR(13);)
       ELSE 
        (counter := counter + 1; 
         result := result + {@yourText}[i];) ;
    );
    
    result;

Crystal报表:在检测到3个逗号后换行。

英文:

Try this:

local numbervar counter := 0;
local stringvar result := "";
local numbervar i;
For i := 1 to Len({@yourText}) do
(
IF {@yourText}[i] <> "," Then result := result + {@yourText}[i];

IF {@yourText}[i] = "," Then 
   IF counter = 2 THEN 
   (counter := 0; 
    result := result + CHR(10) + CHR(13);)
   ELSE 
    (counter := counter + 1; 
     result := result + {@yourText}[i];) ;
);

result;

Crystal报表:在检测到3个逗号后换行。

huangapple
  • 本文由 发表于 2023年2月24日 12:26:41
  • 转载请务必保留本文链接:https://go.coder-hub.com/75552639.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定