Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

? on stripping hyphens from text field - Crystal 5

Status
Not open for further replies.

cindyrella

Programmer
Jul 25, 2003
10
US
I'm a newbie to Crystal 5, so please bear with me. I have a text field that I need to strip of hyphens. There will be a variable number of hyphens in the text field. So far, I have:

StringVar UPC;
NumberVar H1;

UPC := Trim({InventoryMasterfile.UPCCode});

IF Length (UPC)>0 THEN H1:= InStr(UPC,"-");

IF H1=0 THEN UPC:=UPC ELSE

IF H1>0 THEN UPC := Left(UPC,H1-1)+Mid(UPC,H1+1) ;

IF Length (UPC)>0 THEN H1:= InStr(UPC,"-") ;
IF H1=0 THEN UPC:=UPC ELSE
IF H1>0 THEN UPC := Left(UPC,H1-1)+Mid(UPC,H1+1)

What I have gets the first 2 hyphens, but I need to loop through the text field a variable number of times looking for hyphens. Can someone make a suggestion?

Thanks!

 
Mike,
Thanks very much. That did the trick!

synapsevampire:
No, it's the VisiCalc version.


CNS
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top