删除Crystal Report中的字母 [英] Remove the Alphabet in Crystal Report
问题描述
我是Crystal Reports的新手,我正在使用Crystal Reports 2008,我想知道是否可以删除字符串中的字母字符,仅保留数字。
Hi I'm new in Crystal Reports, I'm using Crystal Reports 2008 and I would like to know if how can I remove the alphabet characters in string and only the numbers will remain. Is there function for this?
示例:点231 /点323 / USP 342
输出:231/323/342
example: Point 231 / Point 323 / USP 342 output: 231 / 323 / 342
谢谢,
Captain16
Thanks, Captain16
推荐答案
使用以下公式
Use the following formula
stringvar str;
stringvar str1;
numbervar counter;
numbervar leng;
leng := len({Your_Field});
if leng>0 then
(
for counter := 1 to leng do
(
If (Mid({Your_Field}, counter, 1)) in "a" to "z" Then
(
str1:=str1 + Mid({Your_Field}, counter, 1)
)
else
(
str := str + Mid({Your_Field}, counter, 1)
)
);
str
)
在这里, str
将获得非字母和 str1
只会使您获得给定字符串中的字母。 {您的字段}
可以是包含字符串的字段或参数。通过打印 str
字母可以删除...
231/323/342
这是我从给定输入中得到的输出!
希望这会有所帮助,尝试并返回结果!
Here the str
will get the non-alphabets and str1
will get you only the alphabets from the given string. {Your_Field}
can be your field or parameter which contains the string. And by printing str
alphabets can be removed...
231 / 323 / 342
this is the output I'm getting for your given input !
Hope this helps, Try and get back with results !
这篇关于删除Crystal Report中的字母的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!