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

Trim help...

Status
Not open for further replies.

omacron

Technical User
Feb 5, 2002
149
Hi

I am trying to do a simple Trim command but have some problems. Here is a sample data;

XXXX123456YYYYYYYYY

note: XXXX is a constant
YYYYYYYYY is a constant

What I need to do is strip out the X's and Y's so only the numbers appear. This is what I am doing right now;

Code:
if InStr ({Table.Field}, "XXXX") <> 0 then
    Trim(Mid({Table.Field}, InStr ({Table.Field}, "XXXX") + 4))
else 
  Trim({Table.Field})

This gives me this; 123456YYYYYYYYY

I am not sure how to remove the Y's as well.

thanks
 
Will the Xs always be 4 characters and the Ys always 9 characters? Will the number in the middle always be 6 characters?

Software Sales, Training, Implementation and Support for Macola, eSynergy, and Crystal Reports

"What version of URGENT!!! are you using?
 
mid("XXXX123456YYYYYYYYY" [-10 to 1],5)

-- Jason
"It's Just Ones and Zeros
 
oh Sorry, miss understood your question; the 123456 will be changing. Unless I am very wrong that will not work or I don't understand mid (wouldn't be surprised either way).
 
Mine will (SHOULD)

mine remove the 9 Y's and then removes the 4 X's

-- Jason
"It's Just Ones and Zeros
 
But will the middle part always be 6 characters? If so use:

Mid({YourField},5,6)

Software Sales, Training, Implementation and Support for Macola, eSynergy, and Crystal Reports

"What version of URGENT!!! are you using?
 
That works perfectly thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top