Print Page | Close Window

String Help

Printed From: Crystal Reports Book
Category: Crystal Reports 9 through 2020
Forum Name: Technical Questions
Forum Discription: Formulas, charting data, Crystal syntax, etc.
URL: http://www.crystalreportsbook.com/forum/forum_posts.asp?TID=22865
Printed Date: 26 Apr 2024 at 7:19pm


Topic: String Help
Posted By: Dejaneira
Subject: String Help
Date Posted: 21 Mar 2020 at 4:52am
I am trying to separate a string into its individual parts and somewhere I am missing a step.

Problem:
I have a text field 'Contract Number' which is actually 'Contract Number' - 'Description' and I need to remove the dash and Description from the text string.

Limitations:
I cannot key off the dash because the contract number may also contain a dash or more than one dash.
I cannot Trim Left because the contract number may be a variety of lengths depending on the contract.

I can access the Description field separately. I have tried comparing and removing the Description field, I tried counting the characters in the Description and then trimming. Somewhere I am missing something.

Can anyone point me in the right direction?



Replies:
Posted By: kevlray
Date Posted: 23 Mar 2020 at 4:35am
So the question is, are there any dashes in the comments?  If not.  you could use inStrRev to find the first dash.  Otherwise  I am not sure how you would find it unless you do some sophisticated parsing of the data (i.e., if there is a number after the dash ignore it, but if there is a space then flag it).



Print Page | Close Window