水晶报表拆分字符串公式 [英] crystal reports split string formula
问题描述
我试图只显示字符串字段的日期部分.这是字符串的格式:STARTED:/03/23/1983 TIME:/03:12
I'm trying to only show the date portion of a string field.
This is the format of the string: STARTED:/ 03/23/1983 TIME:/ 03:12
我需要删除STARTED:/"和TIME:/03:12",并且只显示字符串的日期部分:03/23/1983
.我可以使用什么公式来做到这一点?
I need to remove "STARTED:/" and "TIME:/ 03:12" and only show the date portion of the string:03/23/1983
. What formula can I use to do that?
谢谢
推荐答案
Crystal Reports 帮助文件是您的朋友,应该是您解决有关内置函数和数据类型的简单问题的第一站.
The Crystal Reports help file is your friend and should be your first stop for simple questions on built-in functions and data types.
在 CR 中,字符串只是存储为字符数组,因此您可以像数组一样访问它们 - 通过索引.因此,在您的情况下,如果您始终具有相同的字符串格式(即相同数量的字符、前导零等),那么您可以执行以下操作:
In CR strings are just stored as character arrays so you can access them like arrays - by index. So in your case, if you will always have the same string format (that is, the same number of characters, leading zeroes, etc.) then you can do something like this:
local stringvar mystr := {table.your_string}; //mystr:="STARTED:/ 03/23/1983 TIME:/ 03:12"
mystr[11 to 20] //return "03/23/1983"
或者,您可以使用 Mid() 字符串函数.
Alternatively, you could use the Mid() string function.
这篇关于水晶报表拆分字符串公式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!