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!

How to Replace text/Remove the text 1

Status
Not open for further replies.

gy2cool

Programmer
Oct 20, 2010
16
IN
Dear Friends,

I Need help,
I have a string i want to delete some of word.

Below Showing the String.
PIECES = 1.0, FORM = CIRCLE, OD = 1.0, WIDTH = 1.5, LENGTH = 1.5, CUTTING-1 = Circle, TOLERANCE = +.125 -.0, DOCS = CERT\SHIP, PROTECTION = STD, THICK\DIA = 0.1875.
My case i want to remove "WIDTH = 1.5,LENGTH = 1.5" Only.

please Help me.
 
I check out the Replace Function.
But i am not able to resolve it.
 
***** IMP *****
This works for fixed length string.

string old_str, new_str, mystring
long start_pos=1, index

mystring = 'PIECES = 1.0, FORM = CIRCLE, OD = 1.0, WIDTH = 1.5, LENGTH = 1.5, CUTTING-1 = Circle, TOLERANCE = +.125 -.0, DOCS = CERT\SHIP, PROTECTION = STD, THICK\DIA = 0.1875.'

old_str = "W"
new_str = ""

// Find the first occurrence of old_str.
start_pos = Pos(mystring, old_str, start_pos)
for index = 1 to 26
// Replace old_str with new_str.
mystring = Replace(mystring, start_pos,Len(old_str), new_str)
next

Good luck
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top