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 Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Code anywhere within a text field

Status
Not open for further replies.

Phil Thoms

Programmer
Oct 31, 2005
245
GB
I have a field which is 65 characters in length and contains codes in brackets as follows:- (A), (B), (C) and so on.
These can appear in any part of the field. Is there a quick way of deleting these codes. I would normally do it manually but there are over 2000 records.
 
You could use STRTRAN() but you would have to specify each code explicitly so use something like this:
Code:
FOR lnCnt = 65 TO 90
  lcCode = "(" + CHR( lnCnt ) + ")"
  REPLACE ALL [field] WITH STRTRAN( [field], lcCode, '' )
NEXT



----
Andy Kramek
Visual FoxPro MVP
 
Since the philthoms also posted this the the 2.6 forum
STRTRAN will not work in 2.6

So the question is Just what version of FP are you needing an anaswer in ?

David W. Grewe Dave
 
>>Since the philthoms also posted this the the 2.6 forum
STRTRAN will not work in 2.6

Really Dave? Since when has it been broken? This is from the FP2.6 Help File....

STRTRAN()

Searches a character expression or memo field for occurrences of a second character expression or memo field, and then replaces each occurrence with a third character expression or memo field.

Syntax

STRTRAN(<expC1>, <expC2>[, <expC3>] [, <expN1>] [, <expN2>])



----
Andy Kramek
Visual FoxPro MVP
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top