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

string replacement in a memo field

Status
Not open for further replies.

youwannawhat

Programmer
Oct 3, 2001
43
0
0
US
I have a user that has spelled a word incorrectly within a memo field, 2874 times. The word misspelled is contained within an otherwise correct entry.

I am able to retrieve the records with the misspelling by using STRTRAN, but I'm unable to specifically replace(correct) the errant word within the string.

The word is not always in the same position.

Thanks in advance for any help.

 
The ATC function can help you find the position of the first character of the word you are looking for.
STORE 'Now ist the time to program in FoxPro ... ' TO cString
lnReturn= ATC('ist',cString)
lreturn = 5
And combine this "lnReturn" value with the STUFF() function to replace to correct value.
 
REPLACE MemoField WITH ;
STRTRAN(MemoField, "bad_word", "good_word")

will also work.

Dave S.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top