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

AT Command /

Status
Not open for further replies.

EBOUGHEY

Programmer
Joined
Aug 20, 2002
Messages
143
Location
US
I am trying to pull the 2 characters to the left of ".CSV"

Here is the code I have, but it's not working. Please HELP!

Thanks

Elena


REPL ALL KEY with LEFT(ORIGIN,2 at('.CSV',ORIGIN))


Number value changes.... ie:(SERVICE 37.CSV, SERVICE 21.CSV)
 
how about something like this:

Code:
replace all key with (SUBSTR(ORIGIN,AT('.csv',ORIGIN)-2,2))
or if you know that the filename is always going to be two digits, then just use:
Code:
replace all key with (LEFT(ORIGIN,2))

hth
-- frank~
 
How about:

REPL ALL KEY with RIGHT( forceExt(ORIGIN,''), 2 )

- Bill

Get the best answers to your questions -- See FAQ481-4875.
 
oh oops.. i guess i skimmed over the fact that the filenames were in the format (SERVICE xx.CSV).. then the LEFT() function wouldn't work too well..

could also use:
Code:
replace all key with (RIGHT(JUSTSTEM(ORIGIN),2))

-- frank~
 
Have you thought about using RAT() instead?

Regards,

Mike
 
Here are two different ways you could do this:

Use RIGHT(LEFT(ORIGIN, AT('.CSV', ORIGIN) - 1), 2)

or the way I would do it:

RIGHT(ATXLEFT(ORIGIN, '.CSV'), 2)

See FAQ182-5975 for the code for the ATXLEFT() UDF.?


mmerlinn

"Political correctness is the BADGE of a COWARD!"

 
Thanks soooo much everyone. Most of these worked like a charm!

Elena
 
Remember the AT function returns the location so if you want to be after it you need to add 1, to state the obvious.

Bill Couture
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top