Separate alpha from numeric in d3 string
Posted on : 14-01-2009 | By : lhomsher | In : coding, conversion, d3
0
Our post this week is from Clint Hughes, a d3 programmer at Sheeran Direct. Clint’s challenge? To quickly and easily separate numeric values from non-numeric within a single variable. In this case, the numeric values represent a job number and the non-numeric are media source codes. Originally, he thought he’d need to do some sort of string manipulation, but d3 has a handy oconv function that handles the separation beautifully. Here is what he came up with:
001 ** TEST
002 VAL1=”0286XML”
003 VAL2=”12345D”
004 PRINT OCONV(VAL1,’MCN’)
005 PRINT OCONV(VAL1,’MCA’)
006 PRINT OCONV(VAL2,’MCN’)
007 PRINT OCONV(VAL2,’MCA’)
008 STOP
:TEST
0286
XML
12345
D
What’s considered obscure tech info? Well, things that ordinary tech people might not know, or topics/solutions that may be hard to find through the normal Google channels. Over time, I hope this blog will evolve into a nice repository of solutions to all sorts of tech challenges.

