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!

deleting text from fields 1

Status
Not open for further replies.

pumkinjay

Technical User
Dec 19, 2001
9
GB
I have dbf table which after the text stops fills the rest of the field with underscores ie
|field1 |field2 |
|Potatoes___________________|10kg____|
|carrots____________________|5kg_____|
is the a little coing that will strip away this underscore

please help If you can.
from a very poorly trained technician
 
Something like this should do the trick.

var
tc tcursor
n number
endvar

tc.open("table.dbf")
tc.edit()
scan tc:
n = tc.field1.search("_")
if n <> 0 then
tc.field1 = tc.field1.substr(1,n-1)
endif
n = tc.field2.search(&quot;_&quot;)
if n <> 0 then
tc.field2 = tc.field2.substr(1,n-1)
endif
endScan
tc.endEdit()
tc.close()
 
kliot

many thank for the solution
It works swell
&quot;what did i mean by &quot;coing&quot; ??? who knows
Jay
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top