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

Extracting alpha from messy data

Status
Not open for further replies.

wlynch

Technical User
Sep 20, 2010
14
US
Is there a way to extract (eliminate) all the alpha data from a string that looks like this? they want the numbers, not the letters. Thanks.

63(J)
64(J)
67(J)
35(J)
97(R)
xx63(J)
xx96(J)
805(K)
T32(J)
T6(J)
44(J)
xx702(J)
45(J)
xx11(J)
xx54(J)
x3455(P)
 
MikeLewis wrote a nice approach in his reply to another posting a while ago: thread184-1581528

You could modify it to meet your needs pretty easily.

Good Luck,
JRB-Bldr


 
Thanks. I'll look and see if I can figure something out.

WL
 
jrbbldr,

I assume you thought about this portion of Mikes posts in that thread:

Code:
lcNum = <the input number>
lcX = CHRTRAN(lcNum, "0123456789", "") 
lcY = CHRTRAN(lcNum, lcX, "")   && remove unwanted chars

applied to with lcNum = "63(J)" for example this ressults as "63" in lcY.

That answer didn't get a star, so it's not that obvious to wlynch you meant this. That's why I copied this out from there.

Bye, Olaf.
 
I think that is what I am after Olaf. I'll have to play around with it this morning. The entire file has lots of different letters in it and this looks like a winner. Thanks.

Will
 
Olaf - you are correct in which part of Mike's response I was referring to.

wlynch - I hope that Mike's code which Olaf copied here will work for you. It should.
Code:
* --- Mike Lewis's Code ---
lcnum = "63(J)"
lcX = CHRTRAN(lcNum, "0123456789", "")
* --- At this point lcX = "(J)"
lcY = CHRTRAN(lcNum, lcX, "")
* --- Here lcY = "63" ---
As I said before you can probably get what you need by either just using part of the code or modifying it as needed.

Good Luck,
JRB-Bldr
 
What would be good is if the client did'nt insist on using such crazy data in the first place. Thanks to you all. The code does help.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top