bshelby777
asked on
"Cut out" a set substring in Crystal Reports
I have a comment field from the database and I want to "cut out" a portion of the comment and then display the remaining string in a Crystal Report formula field. The substring that I want to eliminate is always the same, but it may not be in the same place. It may also not be in the comment at all. If it appeared in the comment, it would only appear once. I could also use some help on cutting out more than one space between the remaining text strings. For example:
DATABASE COMMENT STRING WANT TO DISPLAY
'This is a comment. Other text. More text' 'Other text. More text'
'More text. This is a comment. Other text' 'More text. Other text'
'Other text This is a comment.' 'Other text'
'More text... and more.This is a comment. More' 'More text... and more. More'
'A different comment' 'A different comment'
I've already created a formula, but need the exact code. This is pseudocode:
if string contains 'This is a comment.'
remove 'This is a comment.' and any spaces inbetween and then display comment
else
display comment
DATABASE COMMENT STRING WANT TO DISPLAY
'This is a comment. Other text. More text' 'Other text. More text'
'More text. This is a comment. Other text' 'More text. Other text'
'Other text This is a comment.' 'Other text'
'More text... and more.This is a comment. More' 'More text... and more. More'
'A different comment' 'A different comment'
I've already created a formula, but need the exact code. This is pseudocode:
if string contains 'This is a comment.'
remove 'This is a comment.' and any spaces inbetween and then display comment
else
display comment
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER